home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / tasm.arc / TASM.DOC < prev    next >
Encoding:
Text File  |  1986-06-20  |  124.0 KB  |  3,061 lines

  1.  
  2.  
  3.       
  4.  
  5.       
  6.  
  7.       
  8.  
  9.       
  10.  
  11.       
  12.  
  13.       
  14.  
  15.       
  16.  
  17.       
  18.  
  19.       
  20.  
  21.       
  22.  
  23.       
  24.  
  25.       
  26.  
  27.                                TASM USER'S MANUAL
  28.  
  29.       
  30.  
  31.       
  32.  
  33.         TASM - A Table Driven Cross Assembler for the MSDOS* Environment
  34.  
  35.       
  36.  
  37.       
  38.  
  39.       
  40.  
  41.       
  42.  
  43.       
  44.  
  45.       
  46.  
  47.       
  48.  
  49.       
  50.  
  51.       
  52.  
  53.                                Thomas N. Anderson
  54.  
  55.                          Speech Technology Incorporated
  56.  
  57.                               16321 176th Avenue NE
  58.  
  59.                              Woodinville, WA   98072
  60.  
  61.       
  62.  
  63.                                    March, 1986
  64.  
  65.                                    Version 2.2
  66.  
  67.       
  68.  
  69.       [Speech Technology Incorporated  is  a  manufacturer  of  electronic
  70.  
  71.       devices  to  aid  the visually impaired,  generally employing speech
  72.  
  73.       synthesis technology.]
  74.  
  75.       
  76.  
  77.       
  78.  
  79.       
  80.  
  81.       (C) Copyright 1985,  1986 by  Speech  Technology  Incorporated.  All 
  82.  
  83.       rights  reserved.  Permission  is  granted to copy this document and 
  84.  
  85.       related software.  
  86.  
  87.       
  88.  
  89.       
  90.  
  91.       If you are dissatisfied with the product for any reason,  return the
  92.  
  93.       original  merchandise (disk and manual) within 90 days to seller for
  94.  
  95.       a full refund of any amounts paid.
  96.  
  97.       
  98.  
  99.       
  100.  
  101.       
  102.  
  103.       
  104.  
  105.       
  106.  
  107.       
  108.  
  109.       
  110.  
  111.        * MSDOS is a trademark of Microsoft Corporation.
  112.  
  113.       
  114.  
  115.       
  116.  
  117.       
  118.  
  119.       
  120.  
  121.  
  122.  
  123.       TASM - Table Driven Assembler                                Page 2    
  124.  
  125.       
  126.  
  127.       
  128.  
  129.       TABLE OF CONTENTS
  130.  
  131.       
  132.  
  133.       
  134.  
  135.       
  136.  
  137.       
  138.  
  139.       
  140.  
  141.       
  142.  
  143.       
  144.  
  145.       
  146.  
  147.       
  148.  
  149.       
  150.  
  151.               SECTION                                        PAGE
  152.  
  153.               ____________________________________________________
  154.  
  155.               INTRODUCTION....................................3
  156.  
  157.               INVOCATION......................................4
  158.  
  159.               SOURCE FORMAT...................................7
  160.  
  161.               EXPRESSIONS.....................................9
  162.  
  163.               ASSEMBLER DIRECTIVES............................12
  164.  
  165.               OBJECT FILE FORMATS.............................18
  166.  
  167.               LISTING FILE FORMAT.............................20
  168.  
  169.               PROM PROGRAMMING................................21
  170.  
  171.               ERROR MESSAGES..................................23
  172.  
  173.               BUGS AND LIMITATIONS............................25
  174.  
  175.               6502 INSTRUCTIONS AND ADDRESSING MODES..........26
  176.  
  177.               8048 INSTRUCTIONS AND ADDRESSING MODES..........29
  178.  
  179.               8051 INSTRUCTIONS AND ADDRESSING MODES..........33
  180.  
  181.               TASM DISTRIBUTION FILES.........................37
  182.  
  183.               PORTING TASM TO OTHER ENVIRONMENTS..............38
  184.  
  185.               TASM INSTRUCTION SET TABLE DEFINITION...........40
  186.  
  187.               SUMMARY.........................................43
  188.  
  189.       
  190.  
  191.               APPENDIX A - SAMPLE LISTING FILE................44
  192.  
  193.               APPENDIX B - SAMPLE INSTRUCTION SET TABLE ......46
  194.  
  195.               APPENDIX C - ORDERING INFORMATION...............51
  196.  
  197.       
  198.  
  199.       
  200.  
  201.       
  202.  
  203.       
  204.  
  205.       
  206.  
  207.       
  208.  
  209.       
  210.  
  211.       
  212.  
  213.       
  214.  
  215.       
  216.  
  217.       
  218.  
  219.       
  220.  
  221.       
  222.  
  223.       
  224.  
  225.       
  226.  
  227.       
  228.  
  229.       
  230.  
  231.       
  232.  
  233.       
  234.  
  235.       
  236.  
  237.       
  238.  
  239.       
  240.  
  241.  
  242.  
  243.       TASM - Table Driven Assembler                                Page 3    
  244.  
  245.       
  246.  
  247.       
  248.  
  249.       INTRODUCTION
  250.  
  251.       
  252.  
  253.       TASM is a set of  table  driven  cross  assemblers  for  the  MS-DOS
  254.  
  255.       environment.  Currently  versions  for  the  6502,  8048,  and  8051
  256.  
  257.       microprocessors are supported by STI,  but the user so inclined  may
  258.  
  259.       build versions for other 8 bit microprocessors (see sections on TASM
  260.  
  261.       DISTRIBUTION  FILES  and  TASM  INSTRUCTION SET TABLE DEFINITION for
  262.  
  263.       notes on reconfiguring TASM for other processors).
  264.  
  265.       
  266.  
  267.       TASM characteristics include:
  268.  
  269.       
  270.  
  271.               1.  Powerful expression parsing (17 operators).
  272.  
  273.       
  274.  
  275.               2.  Supports a subset of the 'C' preprocessor commands.
  276.  
  277.       
  278.  
  279.               3.  Macro capability (through use of DEFINE directive).
  280.  
  281.       
  282.  
  283.               4.  Multiple statements per line.
  284.  
  285.       
  286.  
  287.               5.  Supports three object file formats (Intel Hex, MOS
  288.  
  289.                       Technology Hex, and binary).
  290.  
  291.       
  292.  
  293.               6.  Absolute code generation only.
  294.  
  295.       
  296.  
  297.               7.  Source code available (in C).
  298.  
  299.       
  300.  
  301.               8.  Uniform syntax  across  versions  for  different  target
  302.  
  303.                       machines.
  304.  
  305.       
  306.  
  307.               9.  Features in support  of  PROM  programming  (preset  all
  308.  
  309.                       bytes  to  specified value,  output object code in a
  310.  
  311.                       contiguous block).
  312.  
  313.       
  314.  
  315.               10.  Supports extended instructions of the Rockwell R65C02.
  316.  
  317.       
  318.  
  319.               11.  Tables  can  be  generated  for  other  microprocessors
  320.  
  321.                       without having to modify the TASM executable module.
  322.  
  323.       
  324.  
  325.       
  326.  
  327.       
  328.  
  329.       
  330.  
  331.       
  332.  
  333.       
  334.  
  335.       
  336.  
  337.       
  338.  
  339.       
  340.  
  341.       
  342.  
  343.       
  344.  
  345.       
  346.  
  347.       
  348.  
  349.       
  350.  
  351.       
  352.  
  353.       
  354.  
  355.       
  356.  
  357.       
  358.  
  359.       
  360.  
  361.  
  362.  
  363.       TASM - Table Driven Assembler                                Page 4    
  364.  
  365.       
  366.  
  367.       
  368.  
  369.       INVOCATION
  370.  
  371.       
  372.  
  373.       TASM can be invoked as  follows  (optional fields shown in brackets,
  374.  
  375.       symbolic fields enclosed in <>):
  376.  
  377.       
  378.  
  379.           tasm -<pn> [-bcfhlmpxdo] source_file [object_file [list_file]]
  380.  
  381.       
  382.  
  383.           Where the option flags are defined as follows:
  384.  
  385.       
  386.  
  387.               -<pn>           Specify version (<pn> = part number)
  388.  
  389.               -c              object file written as a contiguous block
  390.  
  391.               -f<xx>          Fill entire memory space with <xx> (hex)
  392.  
  393.               -h              Produce hex table of the assembled code
  394.  
  395.               -l              Produce a label table in the listing
  396.  
  397.               -m              Produce object in MOS Technology format
  398.  
  399.               -b              Produce object in binary (.COM) format
  400.  
  401.               -p              Page the listing file
  402.  
  403.               -q              Quite, disable the listing file
  404.  
  405.               -x[<m>]         Enable extended instruction set (if any)
  406.  
  407.               -d<macro>       Define a macro (or just a macro label)
  408.  
  409.               -o<bb>          Bytes per object record (hex)
  410.  
  411.       
  412.  
  413.       TASM has no built in instruction set tables,  and so  it  must  read
  414.  
  415.       them  at  run time.  TASM determines which table to use based on the
  416.  
  417.       '-<pn>' field shown above.  For example,  to assemble the code in  a
  418.  
  419.       file called 'source.asm' one would enter:
  420.  
  421.       
  422.  
  423.               tasm -48  source.asm            for an 8048 assembly
  424.  
  425.               tasm -65  source.asm            for a  6502 assembly
  426.  
  427.               tasm -51  source.asm            for a  8051 assembly.
  428.  
  429.       
  430.  
  431.       The file name that the tables are read from is formed by taking  the
  432.  
  433.       digits  specified  after  the  '-'  and  appending it to 'TASM' then
  434.  
  435.       appending the '.TAB' extension.  Thus,  the '-48' flag  would  cause
  436.  
  437.       the  tables  to  be  read from the file 'TASM48.TAB' (See section on
  438.  
  439.       TASM INSTRUCTION SET DEFINITION).
  440.  
  441.       
  442.  
  443.       The  source file must be specified.  If not,  some usage information
  444.  
  445.       is displayed.  If the object file is not specified then  the  object
  446.  
  447.       filename  is  formed  by taking the source filename and changing the
  448.  
  449.       extension  to  '.OBJ'.  Similarly,  if  the  list  filename  is  not
  450.  
  451.       specified  it is formed by changing the source filename extension to
  452.  
  453.       '.LST'.
  454.  
  455.       
  456.  
  457.       Each option flag must be  preceded  by  a  dash.  Options  need  not
  458.  
  459.       precede  the filenames,  however.  The various options are described
  460.  
  461.       below:
  462.  
  463.       
  464.  
  465.       c - Contiguous Block Output. If this option is specified,  then  all
  466.  
  467.       bytes  in the range from the lowest used byte to the highest will be
  468.  
  469.       defined in the object file.  Normally,  with the default  Intel  Hex
  470.  
  471.       object  format  enabled,  if  the Program Counter (PC) jumps forward
  472.  
  473.       because of an .ORG directive,  the bytes skipped over will not  have
  474.  
  475.       any  value  assigned  them  in  the  object  file.  With this option
  476.  
  477.       enabled,  no output to the object file occurs until the end  of  the
  478.  
  479.       assembly  at  which time the whole block is written.  This is useful
  480.  
  481.  
  482.  
  483.       TASM - Table Driven Assembler                                Page 5    
  484.  
  485.       
  486.  
  487.       when using TASM to generate code that will be put  into  a  PROM  so
  488.  
  489.       that  all  locations  will have a known value.  This option is often
  490.  
  491.       used in conjunction with the -f option to ensure  all  unused  bytes
  492.  
  493.       will have a known value.
  494.  
  495.       
  496.  
  497.       f  -  Fill  Memory.  This  option  causes the memory image that TASM
  498.  
  499.       maintains to be initialized to the value specified by  the  two  hex
  500.  
  501.       characters  immediately  following the 'f'.  TASM maintains a memory
  502.  
  503.       image that is a full 64K bytes in size (even if the target processor
  504.  
  505.       cannot  utilize  that  memory  space).  Invocation  of  this  option
  506.  
  507.       introduces a 2 second delay at start up (time required to initialize
  508.  
  509.       all 64K bytes).   See Appendix A for an example.
  510.  
  511.       
  512.  
  513.       h - Hex Table. This option causes a hex table of the produced object
  514.  
  515.       code to appear in the listing file.  Each line of  the  table  shows
  516.  
  517.       sixteen bytes of code.  The format is shown in the sample listing in
  518.  
  519.       Appendix A.
  520.  
  521.       
  522.  
  523.       l - Label Table. This option causes a label table to appear  in  the
  524.  
  525.       listing  file.  Each  label is  shown  with its corresponding value.
  526.  
  527.       Macro labels (as established  via  the  DEFINE  directives)  do  not
  528.  
  529.       appear.  The format is shown in the sample listing in Appendix A.
  530.  
  531.       
  532.  
  533.       m - MOS Technology Object Format. This option causes the object file
  534.  
  535.       to be written in MOS Technology hex format rather than  the  default
  536.  
  537.       Intel  hex  format.  See  section  on  OBJECT  FILE  FORMATS  for  a
  538.  
  539.       description of the format.
  540.  
  541.       
  542.  
  543.       b  -  Binary Object Format. This option causes the object file to be
  544.  
  545.       written in binary - one byte for each byte of code/data.  Note  that
  546.  
  547.       no  address  information  is  included  in  the  object file in this
  548.  
  549.       format.  The contiguous block (-c) output mode is forced  when  this
  550.  
  551.       option is invoked.
  552.  
  553.       
  554.  
  555.       p - Page Listing File.  This option causes the listing file to  have 
  556.  
  557.       top of page headers and form feeds inserted at appropriate intervals 
  558.  
  559.       (every sixty lines of output).  
  560.  
  561.       
  562.  
  563.       q - Disable Listing File.  This option  causes  all  output  to  the 
  564.  
  565.       listing  file  to  be  suppressed,   unless  a  .LIST  directive  is 
  566.  
  567.       encountered in the source file (see LIST/NOLIST directives).  
  568.  
  569.       
  570.  
  571.       x - Enable Extended Instruction  Set.  If  a  processor  family  has
  572.  
  573.       instructions  that  are valid for only certain members,  this option
  574.  
  575.       can be used to enable those beyond the  basic  standard  instruction
  576.  
  577.       set.  Presently,  this  option  only  has  significance for the 6502
  578.  
  579.       version (TASM -65) which has extended instructions for the  Rockwell
  580.  
  581.       R65C02  and  the  R65C00/21.  A  hex  digit  may  follow  the 'x' to
  582.  
  583.       indicate a mask value used in selecting the appropriate  instruction
  584.  
  585.       set.  Bit  0  of the mask selects the basic instruction set,  thus a
  586.  
  587.       '-x1' would have no effect.  A '-x3' would enable the basic set plus
  588.  
  589.       whatever instructions have bit 1 set in their  class  mask.  A  '-x'
  590.  
  591.       without  a  digit  following is equivalent to a '-xf' which sets all
  592.  
  593.       four of the  mask  bits.  (See  section  on  6502  INSTRUCTIONS  AND
  594.  
  595.       ADDRESSING MODES for details on its extended instructions).
  596.  
  597.       
  598.  
  599.       
  600.  
  601.  
  602.  
  603.       TASM - Table Driven Assembler                                Page 6    
  604.  
  605.       
  606.  
  607.       d - Define a Macro. Macros  are  be  defined  on  the  command  line
  608.  
  609.       generally to control the assembly of various IFDEF's that are in the
  610.  
  611.       source  file.  This is a convenient way to generate various versions
  612.  
  613.       of object code from a single source file.
  614.  
  615.       
  616.  
  617.       o - Set Number of Bytes per Object Record.  When  generating  object
  618.  
  619.       code in either the MOS Technology format or the Intel hex format,  a
  620.  
  621.       default of 24 (decimal) bytes of object are defined on each  record.
  622.  
  623.       This can be altered by invoking the '-o' option immediately followed
  624.  
  625.       by  two  hex digits defining the number of bytes per record desired.
  626.  
  627.       For example,  if 32 bytes per record are desired,  one might  invoke
  628.  
  629.       TASM as:
  630.  
  631.       
  632.  
  633.               TASM -48 -o20 source.asm
  634.  
  635.       
  636.  
  637.       
  638.  
  639.       
  640.  
  641.       
  642.  
  643.       
  644.  
  645.       
  646.  
  647.       
  648.  
  649.       
  650.  
  651.       
  652.  
  653.       
  654.  
  655.       
  656.  
  657.       
  658.  
  659.       
  660.  
  661.       
  662.  
  663.       
  664.  
  665.       
  666.  
  667.       
  668.  
  669.       
  670.  
  671.       
  672.  
  673.       
  674.  
  675.       
  676.  
  677.       
  678.  
  679.       
  680.  
  681.       
  682.  
  683.       
  684.  
  685.       
  686.  
  687.       
  688.  
  689.       
  690.  
  691.       
  692.  
  693.       
  694.  
  695.       
  696.  
  697.       
  698.  
  699.       
  700.  
  701.       
  702.  
  703.       
  704.  
  705.       
  706.  
  707.       
  708.  
  709.       
  710.  
  711.       
  712.  
  713.       
  714.  
  715.       
  716.  
  717.       
  718.  
  719.       
  720.  
  721.  
  722.  
  723.       TASM - Table Driven Assembler                                Page 7    
  724.  
  725.       
  726.  
  727.       
  728.  
  729.       SOURCE FORMAT
  730.  
  731.       
  732.  
  733.       Statements in the source file must conform to a  format  as  follows
  734.  
  735.       (except  for assembler directive statements which are described in a
  736.  
  737.       subsequent section):
  738.  
  739.       
  740.  
  741.               <label>  <operation>    <operand>       <comment>
  742.  
  743.       
  744.  
  745.       All of the fields are optional, under appropriate circumstances.  An
  746.  
  747.       arbitrary amount of white space (space and tabs) can  separate  each
  748.  
  749.       field  (as  long as the maximum line length of 255 characters is not
  750.  
  751.       exceeded).  Each of fields are described below:
  752.  
  753.       
  754.  
  755.       
  756.  
  757.       Label Field. If the first character of the line is alphabetic, it is
  758.  
  759.       assumed  to  be  the  start  of  a label.  Subsequent characters are
  760.  
  761.       accepted as part of that  label  until  a  space,  tab,  or  ':'  is
  762.  
  763.       encountered.   The   assembler   assigns   a   value  to  the  label
  764.  
  765.       corresponding to the current  location  counter.  Labels  can  be  a
  766.  
  767.       maximum  of  13 characters long.  Labels can contain upper and lower
  768.  
  769.       case letters, digits, underscores,  and periods (the first character
  770.  
  771.       must  be alphabetic).  Labels are case sensitive - the label 'START'
  772.  
  773.       is a different label from 'start'.
  774.  
  775.       
  776.  
  777.       Operation  Field.  The  operation  field  contains  an   instruction
  778.  
  779.       (opcode)  mnemonic  which  specifies the action to be carried out by
  780.  
  781.       the  target  processor  when  this  instruction  is  executed.   The
  782.  
  783.       interpretation  of each mnemonic is dependent on the version of TASM
  784.  
  785.       being used (see  section  on  OPCODES  AND  ADDRESSING  MODES).  The
  786.  
  787.       operation  field  may  begin  in  any  column except the first.  The
  788.  
  789.       operation field is case insensitive.
  790.  
  791.       
  792.  
  793.       Operand Field. The operand field specifies the data to  be  operated
  794.  
  795.       on  by  the  instruction.  It may include expressions and/or special
  796.  
  797.       symbols describing the  addressing  mode  to  be  used.  The  actual
  798.  
  799.       format and interpretation is dependent on the target processor.  For
  800.  
  801.       a description of the format for currently supported processors,  see
  802.  
  803.       the section on OPCODES AND ADDRESSING MODES  for  the  processor  of
  804.  
  805.       interest.
  806.  
  807.       
  808.  
  809.       Comment  Field.  The  comment  field always begins with a semicolon.
  810.  
  811.       The rest of the line from the semicolon to the end of  the  line  is
  812.  
  813.       ignored  by  TASM,  but passed on to the listing file for annotation
  814.  
  815.       purposes.  The comment field must be the last field on a  line,  but
  816.  
  817.       it may be the only field, starting in column one, if desired.
  818.  
  819.       
  820.  
  821.       Multiple  Statement Lines. If the backslash character is encountered
  822.  
  823.       on a source line,  it is treated as a newline.  The remainder of the
  824.  
  825.       line  following  the  backslash  will be processed as an independent
  826.  
  827.       line of source code.  This allows one to put multiple statements  on
  828.  
  829.       a line.  This facility is not so useful of itself,  but when coupled
  830.  
  831.       with the capability  of  the  DEFINE  directive,  powerful  multiple
  832.  
  833.       statement  macros  can  be  constructed  (see  section  on ASSEMBLER
  834.  
  835.       DIRECTIVES).  Note that when  using  the  statement  separator,  the
  836.  
  837.       character  immediately  following  it should be considered the first
  838.  
  839.       character of a new line,  and thus must either be a start of a label
  840.  
  841.  
  842.  
  843.       TASM - Table Driven Assembler                                Page 8    
  844.  
  845.       
  846.  
  847.       or  white space (not an instruction).  As the examples show, a space
  848.  
  849.       is put between the backslash and the start of the next instruction.
  850.  
  851.       
  852.  
  853.       
  854.  
  855.       
  856.  
  857.       
  858.  
  859.       Some  examples  of  valid  source  statements follow (6502 mnemonics
  860.  
  861.       shown):
  862.  
  863.       
  864.  
  865.       label1  lda     byte1   ;get the first byte
  866.  
  867.               dec     byte1
  868.  
  869.               jne     label1
  870.  
  871.       
  872.  
  873.       ;
  874.  
  875.       label2
  876.  
  877.               sta     byte2,X
  878.  
  879.               ; a multiple statement line follows
  880.  
  881.               lda     byte1\ sta byte1+4\ lda byte2\ sta byte2+4
  882.  
  883.       
  884.  
  885.       
  886.  
  887.       
  888.  
  889.       
  890.  
  891.       
  892.  
  893.       
  894.  
  895.       
  896.  
  897.       
  898.  
  899.       
  900.  
  901.       
  902.  
  903.       
  904.  
  905.       
  906.  
  907.       
  908.  
  909.       
  910.  
  911.       
  912.  
  913.       
  914.  
  915.       
  916.  
  917.       
  918.  
  919.       
  920.  
  921.       
  922.  
  923.       
  924.  
  925.       
  926.  
  927.       
  928.  
  929.       
  930.  
  931.       
  932.  
  933.       
  934.  
  935.       
  936.  
  937.       
  938.  
  939.       
  940.  
  941.       
  942.  
  943.       
  944.  
  945.       
  946.  
  947.       
  948.  
  949.       
  950.  
  951.       
  952.  
  953.       
  954.  
  955.       
  956.  
  957.       
  958.  
  959.       
  960.  
  961.  
  962.  
  963.       TASM - Table Driven Assembler                                Page 9    
  964.  
  965.       
  966.  
  967.       
  968.  
  969.       EXPRESSIONS
  970.  
  971.       
  972.  
  973.       Expressions are made  up  of  various  syntactic  elements  (tokens)
  974.  
  975.       combined  according  to  a set of syntactical rules.  The tokens are
  976.  
  977.       summarized as follows:
  978.  
  979.       
  980.  
  981.               1.  Labels
  982.  
  983.               2.  Constants
  984.  
  985.               3.  Location Counter Symbol
  986.  
  987.               4.  Operators
  988.  
  989.               5.  Parenthesis
  990.  
  991.       
  992.  
  993.       Labels. Labels are strings of characters that have a  numeric  value
  994.  
  995.       associated with them, generally representing an address.  Labels can
  996.  
  997.       contain  upper  and  lower case letters,  digits,  underscores,  and
  998.  
  999.       periods.  The first character must be a letter  (to  distinguish  it
  1000.  
  1001.       from a numeric constant).  The value of a label is limited to 16 bit
  1002.  
  1003.       precision.  Labels can contain up to 13 characters, all of which are
  1004.  
  1005.       significant (none are ignored when looking at a labels value,  as in
  1006.  
  1007.       some assemblers).
  1008.  
  1009.       
  1010.  
  1011.       Constants.  Numeric constants must always begin with a decimal digit
  1012.  
  1013.       (thus hexadecimal  constants  that  start  with  a  letter  must  be
  1014.  
  1015.       prefixed by a '0').  The radix is determined by a letter immediately
  1016.  
  1017.       following the digit string according to the following table:
  1018.  
  1019.       
  1020.  
  1021.               Radix           Suffix                  Prefix
  1022.  
  1023.               ---------------------------------------------------
  1024.  
  1025.               2               B or b                    %
  1026.  
  1027.               8               O or o                    @
  1028.  
  1029.               10              D or d (or nothing)
  1030.  
  1031.               16              H or h                    $
  1032.  
  1033.       
  1034.  
  1035.       Decimal is the default radix, so decimal constants need no suffix or
  1036.  
  1037.       prefix.
  1038.  
  1039.       
  1040.  
  1041.       The following representations are equivalent:
  1042.  
  1043.       
  1044.  
  1045.               1234H           or      $1234
  1046.  
  1047.               100d            or      100
  1048.  
  1049.               177400O         or      @177400
  1050.  
  1051.               01011000b       or      %01011000
  1052.  
  1053.       
  1054.  
  1055.       The  prefixes  are provided for compatibility with some other source
  1056.  
  1057.       code formats but introduce a problem of ambiguity.  Both '%' and '$'
  1058.  
  1059.       have alternate uses  ('%'  for  modulo,  '$'  for  location  counter
  1060.  
  1061.       symbol).  To  resolve this,  some simple rules are employed.  If the
  1062.  
  1063.       first character following a '%' is a '0' or '1', it is assumed to be
  1064.  
  1065.       a radix specifier and not the modulo  operator.  Similarly,  if  the
  1066.  
  1067.       first character following a '$' is a valid hexadecimal digit,  it is
  1068.  
  1069.       assumed to be a radix specifier and not the location  counter.  This
  1070.  
  1071.       can  cause problems,  however.  Suppose you wanted to find the value
  1072.  
  1073.       of the low byte of the label 'PNTR_TABLE', you might do this:
  1074.  
  1075.       
  1076.  
  1077.               (PNTR_TABLE%0100h)
  1078.  
  1079.       
  1080.  
  1081.  
  1082.  
  1083.       TASM - Table Driven Assembler                                Page 10  
  1084.  
  1085.       
  1086.  
  1087.       Here the '%' would mistakenly be taken for  a  radix  specifier.  To
  1088.  
  1089.       correct  the  problem one need only insert a space in an appropriate
  1090.  
  1091.       spot:
  1092.  
  1093.       
  1094.  
  1095.               (PNTR_TABLE % 0100h)
  1096.  
  1097.       
  1098.  
  1099.       Character  constants  are  single  characters  surrounded  by single
  1100.  
  1101.       quotes (following  quote  is  optional).  The  ASCII  value  of  the
  1102.  
  1103.       character  in the quotes is returned.  No escape provision exists to
  1104.  
  1105.       represent non-printable characters within the quotes,  but  this  is
  1106.  
  1107.       not  necessary  since  these  can  be  just as easily represented as
  1108.  
  1109.       numeric constants.
  1110.  
  1111.       
  1112.  
  1113.       String constants are one or more  characters  surrounded  by  double
  1114.  
  1115.       quotes.  Note  that string constants are not allowed in expressions.
  1116.  
  1117.       They are only allowable following the 'TITLE' and  'TEXT'  assembler
  1118.  
  1119.       directives.
  1120.  
  1121.       
  1122.  
  1123.       Location  Counter  Symbol. The current value of the location counter
  1124.  
  1125.       (PC) can be used in expressions by placing  a  '$'  in  the  desired
  1126.  
  1127.       place.  The  Location Counter Symbol is allowable anywhere a numeric
  1128.  
  1129.       constant is.  (Note that if the '$' is followed by a  decimal  digit
  1130.  
  1131.       then  it  is  taken to be the hexadecimal radix indicator instead of
  1132.  
  1133.       the Location Counter symbol,  as mentioned above).  The '*' may also
  1134.  
  1135.       be  used  to  represent the location counter,  but is less preferred
  1136.  
  1137.       because of its ambiguity with the multiplicative operator.
  1138.  
  1139.       
  1140.  
  1141.       Operators. Expressions can optionally contain operators  to  perform
  1142.  
  1143.       some   alterations   or  calculations  on  particular  values.   The
  1144.  
  1145.       operators are summarized as follows:
  1146.  
  1147.       
  1148.  
  1149.               Operator  Type          Description
  1150.  
  1151.               __________________________________________
  1152.  
  1153.               +        Additive       addition
  1154.  
  1155.               -                       subtraction
  1156.  
  1157.       
  1158.  
  1159.               *        Multiplicative multiplication
  1160.  
  1161.               /                       division
  1162.  
  1163.               %                       modulo
  1164.  
  1165.               <<                      logical shift left
  1166.  
  1167.               >>                      logical shift right
  1168.  
  1169.       
  1170.  
  1171.               ~        Unary          bit inversion (one's complement)
  1172.  
  1173.               -                       unary negation
  1174.  
  1175.       
  1176.  
  1177.               =        Relational     equal
  1178.  
  1179.               ==                      equal
  1180.  
  1181.               !=                      not equal
  1182.  
  1183.               <                       less than
  1184.  
  1185.               >                       greater than
  1186.  
  1187.               <=                      less than or equal
  1188.  
  1189.               >=                      greater than or equal
  1190.  
  1191.       
  1192.  
  1193.               &       Binary          binary 'and'
  1194.  
  1195.               |                       binary 'or'
  1196.  
  1197.               ^                       binary 'exclusive or'
  1198.  
  1199.       
  1200.  
  1201.  
  1202.  
  1203.       TASM - Table Driven Assembler                                Page 11  
  1204.  
  1205.       
  1206.  
  1207.       The syntax is much the same as in 'C' with the following notes:
  1208.  
  1209.       
  1210.  
  1211.               1.  No operator precedence is in effect.  Evaluation is from
  1212.  
  1213.                       left to right unless grouped by  parenthesis  (  see
  1214.  
  1215.                       example below).
  1216.  
  1217.       
  1218.  
  1219.               2.  All evaluations are done with 16 bit precision.
  1220.  
  1221.       
  1222.  
  1223.               3.  Both '=' and '==' are allowable equality checkers.  This
  1224.  
  1225.                       is allowed   since   the  syntax  does  not  provide
  1226.  
  1227.                       assignment capability (as '=' would normally be used
  1228.  
  1229.                       for).
  1230.  
  1231.       
  1232.  
  1233.       The relational operators return a value of 1 if the relation is true
  1234.  
  1235.       and 0 if it is false.  Sixteen bit signed arithmetic is used.
  1236.  
  1237.       
  1238.  
  1239.       It is always a good idea to explicitly indicate the desired order of
  1240.  
  1241.       evaluation with  parenthesis,  especially  to  maintain  portability
  1242.  
  1243.       since  TASM does not evaluate expressions in the same manner as many
  1244.  
  1245.       other assemblers.  To understand how it does arrive  at  the  values
  1246.  
  1247.       for expressions, consider the following example:
  1248.  
  1249.       
  1250.  
  1251.               1 + 2*3 + 4
  1252.  
  1253.       
  1254.  
  1255.       TASM would start at the left and read the first token '1'  and  then
  1256.  
  1257.       the  operator  '+'.  To  determine  what  to  add  to  the '1',  the
  1258.  
  1259.       expression evaluator would be called recursively on the remainder of
  1260.  
  1261.       the expression.  The next pass would read the '2' and '*'  and  then
  1262.  
  1263.       call  itself again to evaluate the rest.  Another level of recursion
  1264.  
  1265.       would take place in evaluating the '4'.  Since it is not followed by
  1266.  
  1267.       any more operators, the recursion would start undoing itself and the
  1268.  
  1269.       final expression would be evaluated as:
  1270.  
  1271.       
  1272.  
  1273.               1 + (2 * (3 + (4))) = 15
  1274.  
  1275.       
  1276.  
  1277.       If the user had desired the '*' to take precedence, the following
  1278.  
  1279.       could have been done:
  1280.  
  1281.       
  1282.  
  1283.               1 + (2*3) + 4
  1284.  
  1285.       
  1286.  
  1287.       Use parenthesis liberally.
  1288.  
  1289.       
  1290.  
  1291.       Here are some examples of valid expressions:
  1292.  
  1293.       
  1294.  
  1295.               (0f800H + tab)
  1296.  
  1297.               (label_2 >> 8)
  1298.  
  1299.               (label_3 << 8) & $f000
  1300.  
  1301.               $ + 4
  1302.  
  1303.               010010000100100b + 'a'
  1304.  
  1305.               (base + ((label_4 >> 5) & (mask << 2))
  1306.  
  1307.       
  1308.  
  1309.       
  1310.  
  1311.       
  1312.  
  1313.       
  1314.  
  1315.       
  1316.  
  1317.       
  1318.  
  1319.       
  1320.  
  1321.  
  1322.  
  1323.       TASM - Table Driven Assembler                                Page 12  
  1324.  
  1325.       
  1326.  
  1327.       
  1328.  
  1329.       ASSEMBLER DIRECTIVES
  1330.  
  1331.       
  1332.  
  1333.       Most of the assembler  directives  have  a  format  similar  to  the
  1334.  
  1335.       machine   instruction   format.   However,   instead  of  specifying
  1336.  
  1337.       operations for the processor to carry out,  the directives cause the
  1338.  
  1339.       assembler  to perform some function related to the assembly process.
  1340.  
  1341.       TASM has two types of assembler directives - those  that  mimic  the
  1342.  
  1343.       'C'  preprocessor  functions,  and  those  that  resemble  the  more
  1344.  
  1345.       traditional assembler directive functions.  Each of  these  will  be
  1346.  
  1347.       discussed.
  1348.  
  1349.       
  1350.  
  1351.       The  'C' preprocessor style directives are are invoked with a '#' as
  1352.  
  1353.       the  first  character  of  the  line  followed  by  the  appropriate
  1354.  
  1355.       directive  (just  as in 'C').  Thus,  these directives cannot have a
  1356.  
  1357.       label preceding  them (on the same line).  Note that in the examples
  1358.  
  1359.       directives are shown in upper case,  however,  either upper or lower
  1360.  
  1361.       case is acceptable.
  1362.  
  1363.       
  1364.  
  1365.       INCLUDE. The INCLUDE directive reads in and assembles the  indicated
  1366.  
  1367.       source  file.  INCLUDEs can be nested up to six levels.  This allows
  1368.  
  1369.       a convenient means to  keep  common  definitions,  declarations,  or
  1370.  
  1371.       subroutines  in  files  to  be included as needed.  The format is as
  1372.  
  1373.       follows:
  1374.  
  1375.       
  1376.  
  1377.               #INCLUDE        <filename>
  1378.  
  1379.       
  1380.  
  1381.       The  <filename>  must  be  enclosed in double quotes.  Here are some
  1382.  
  1383.       examples:
  1384.  
  1385.       
  1386.  
  1387.               #INCLUDE        "macros.h"
  1388.  
  1389.               #include "equates"
  1390.  
  1391.               #include "subs.asm"
  1392.  
  1393.       
  1394.  
  1395.       
  1396.  
  1397.       DEFINE.  The  DEFINE  directive  is  one of the most powerful of the
  1398.  
  1399.       directives and allows string substitution  with  optional  arguments
  1400.  
  1401.       (macros).  The format is as follows:
  1402.  
  1403.       
  1404.  
  1405.               #DEFINE  <macro_label>[(<arg_list>)]      [<macro_definition>]
  1406.  
  1407.       
  1408.  
  1409.               <macro_label> := character string to be expanded when found
  1410.  
  1411.                                       in the source file.
  1412.  
  1413.       
  1414.  
  1415.               <arg_list>    := optional argument list for variable
  1416.  
  1417.                                       substitution in macro expansion.
  1418.  
  1419.       
  1420.  
  1421.               <macro_def>   := character string to replace the occurrences
  1422.  
  1423.                                       of <macro_label> in the source file.
  1424.  
  1425.       
  1426.  
  1427.       
  1428.  
  1429.       
  1430.  
  1431.       The simplest form of the DEFINE directive might look like this:
  1432.  
  1433.       
  1434.  
  1435.               #DEFINE         MLABEL
  1436.  
  1437.       
  1438.  
  1439.       Notice  that no substitutionary string is specified.  The purpose of
  1440.  
  1441.  
  1442.  
  1443.       TASM - Table Driven Assembler                                Page 13  
  1444.  
  1445.       
  1446.  
  1447.       a statement like this would typically be to define a label  for  the
  1448.  
  1449.       purpose  of  controlling some subsequent conditional assembly (IFDEF
  1450.  
  1451.       or IFNDEF).
  1452.  
  1453.       
  1454.  
  1455.       A more complicated example,  performing simple  substitution,  might
  1456.  
  1457.       look like this:
  1458.  
  1459.       
  1460.  
  1461.               #DEFINE         VAR1_LO         (VAR1 & 255)
  1462.  
  1463.       
  1464.  
  1465.       This statement would cause all occurrences of the  string  'VAR1_LO'
  1466.  
  1467.       in the source to be substituted with '(VAR1 & 255)'.
  1468.  
  1469.       
  1470.  
  1471.       As  a  more  complicated  example,   using  the  argument  expansion
  1472.  
  1473.       capability, consider this:
  1474.  
  1475.       
  1476.  
  1477.               #DEFINE         ADD(xx,yy)      clc\ lda xx\ adc yy\ sta xx
  1478.  
  1479.       
  1480.  
  1481.       If the source file then contained a line like this:
  1482.  
  1483.       
  1484.  
  1485.               ADD(VARX,VARY)
  1486.  
  1487.       
  1488.  
  1489.       It would be expanded to:
  1490.  
  1491.       
  1492.  
  1493.               clc\ lda VARX\ adc VARY\ sta VARX
  1494.  
  1495.       
  1496.  
  1497.       The above example shows the use of the backslash ('\') character  as
  1498.  
  1499.       a  multiple  instruction  statement delimiter.  This approach allows
  1500.  
  1501.       the definition of fairly powerful,  multiple statement  macros.  The
  1502.  
  1503.       example shown generates 6502 instructions to add one memory location
  1504.  
  1505.       to another.
  1506.  
  1507.       
  1508.  
  1509.       Some rules associated with the argument list:
  1510.  
  1511.       
  1512.  
  1513.               1.  Use a maximum of 10 arguments.
  1514.  
  1515.       
  1516.  
  1517.               2.  An argument in the DEFINE statement  must  be  a  unique
  1518.  
  1519.                       string  (unique  on  that line) occurring only as an
  1520.  
  1521.                       argument  elsewhere  in  the  line.   TASM  does   a
  1522.  
  1523.                       straight  forward  search  for the occurrence of the
  1524.  
  1525.                       specified argument strings in  the  macro_definition
  1526.  
  1527.                       field  and  if  the  string  is  found somewhere not
  1528.  
  1529.                       intended,  bad things  will  happen.  In  the  above
  1530.  
  1531.                       example,  if  a  simple '(a,b)' had been used as the
  1532.  
  1533.                       argument list instead '(xx,yy)',  then each  'a'  in
  1534.  
  1535.                       the  definition  would be expanded (e.g.  the 'a' in
  1536.  
  1537.                       'lda').
  1538.  
  1539.       
  1540.  
  1541.               3.  Each argument should be a maximum of 15 characters.
  1542.  
  1543.       
  1544.  
  1545.       Note that macros can be defined on the TASM command line, also, with
  1546.  
  1547.       the '-d' option flag.
  1548.  
  1549.       
  1550.  
  1551.       IFDEF.  This directive can be used to optionally assemble a block of
  1552.  
  1553.       code.  It has the following form:
  1554.  
  1555.       
  1556.  
  1557.               #IFDEF  <macro_label>
  1558.  
  1559.       
  1560.  
  1561.  
  1562.  
  1563.       TASM - Table Driven Assembler                                Page 14  
  1564.  
  1565.       
  1566.  
  1567.       When invoked,  the list of  macro  labels  (established  via  DEFINE
  1568.  
  1569.       directives) is searched.  If the label is found, the following lines
  1570.  
  1571.       of  code  are  assembled.  If  not found,  the input file is skipped
  1572.  
  1573.       until an ENDIF or ELSE directive is found.
  1574.  
  1575.       
  1576.  
  1577.       Lines that are skipped over still appear in the listing file,  but a
  1578.  
  1579.       '~'  will appear immediately after the current PC and no object code
  1580.  
  1581.       will be generated (this is applicable to IFDEF, IFNDEF, and IF).
  1582.  
  1583.       
  1584.  
  1585.       IFNDEF. This directive is the opposite of the IFDEF  directive.  The
  1586.  
  1587.       block   of  code  following  is  assembled  only  if  the  specified
  1588.  
  1589.       macro_label is undefined.  It has the following form:
  1590.  
  1591.       
  1592.  
  1593.               #IFNDEF  <macro_label>
  1594.  
  1595.       
  1596.  
  1597.       When invoked,  the list of  macro  labels  (established  via  DEFINE
  1598.  
  1599.       directives)  is searched.  If the label is not found,  the following
  1600.  
  1601.       lines of code are assembled.  If it is  found,  the  input  file  is
  1602.  
  1603.       skipped until an ENDIF or ELSE directive is found.
  1604.  
  1605.       
  1606.  
  1607.       IF.  This  directive  can  be used to optionally assemble a block of
  1608.  
  1609.       code dependent on the value of a given expression.  The format is as
  1610.  
  1611.       follows:
  1612.  
  1613.       
  1614.  
  1615.               #IF     <expr>
  1616.  
  1617.       
  1618.  
  1619.       If the expression <expr> evaluates to non-zero, the following block
  1620.  
  1621.       of code is assembled (until an ENDIF or ELSE is encountered).
  1622.  
  1623.       
  1624.  
  1625.       
  1626.  
  1627.       ENDIF. This directive must always follow an  IFDEF,  IFNDEF,  or  IF
  1628.  
  1629.       directive and signifies the end of the conditional block.
  1630.  
  1631.       
  1632.  
  1633.       ELSE. This directive can optionally be used with IFDEF,  IFNDEF  and
  1634.  
  1635.       IF  to  delineate  an alternate block of code to be assembled if the
  1636.  
  1637.       block  immediately  following  the  IFDEF,   IFNDEF  or  IF  is  not
  1638.  
  1639.       assembled.
  1640.  
  1641.       
  1642.  
  1643.       Here are some examples of the use of IFDEF, IFNDEF,  IF,  ELSE,  and
  1644.  
  1645.       ENDIF:
  1646.  
  1647.       
  1648.  
  1649.               #IFDEF  label1
  1650.  
  1651.               lda     byte1
  1652.  
  1653.               sta     byte2
  1654.  
  1655.               #ENDIF
  1656.  
  1657.       
  1658.  
  1659.               #ifdef  label1
  1660.  
  1661.               lda     byte1
  1662.  
  1663.               #else
  1664.  
  1665.               lda     byte2
  1666.  
  1667.               #endif
  1668.  
  1669.       
  1670.  
  1671.               #ifndef label1
  1672.  
  1673.               lda     byte2
  1674.  
  1675.               #else
  1676.  
  1677.               lda     byte1
  1678.  
  1679.               #endif
  1680.  
  1681.  
  1682.  
  1683.       TASM - Table Driven Assembler                                Page 15  
  1684.  
  1685.       
  1686.  
  1687.       
  1688.  
  1689.               #if ($ >= 1000h)
  1690.  
  1691.               ; generate an invalid statement to cause an error
  1692.  
  1693.               ;  when we go over the 4K boundary.
  1694.  
  1695.                !!! PROM bounds exceeded.
  1696.  
  1697.               #endif
  1698.  
  1699.       
  1700.  
  1701.       ORG. This directive  provides  the  means  to  set  the  Instruction
  1702.  
  1703.       Pointer  (a.k.a.  Program Counter) to the desired value.  The format
  1704.  
  1705.       is:
  1706.  
  1707.       
  1708.  
  1709.               [<label>] .ORG    <expr>
  1710.  
  1711.       
  1712.  
  1713.       The <label> is optional.  The Instruction pointer  is  assigned  the
  1714.  
  1715.       value  of  the  expression,  <expr>.  For example,  to generate code
  1716.  
  1717.       starting at address 1000H, the following could be done:
  1718.  
  1719.       
  1720.  
  1721.               start   .ORG    1000H
  1722.  
  1723.       
  1724.  
  1725.       The expression  (<expr>)  may  contain  references  to  the  current
  1726.  
  1727.       Instruction Pointer, thus allowing various manipulations to be done.
  1728.  
  1729.       For  example,  to align the Instruction Pointer on the next 256 byte
  1730.  
  1731.       boundary, the following could be done:
  1732.  
  1733.       
  1734.  
  1735.                       .ORG  (($ + FFH) & FF00H)
  1736.  
  1737.       
  1738.  
  1739.       ORG can also be used to reserve space without assigning values:
  1740.  
  1741.       
  1742.  
  1743.                       .ORG    $+8
  1744.  
  1745.       
  1746.  
  1747.       An alternate form of ORG is '*=' or '$='.  Thus  the  following  two
  1748.  
  1749.       examples as exactly equivalent to the previous example:
  1750.  
  1751.       
  1752.  
  1753.                       *=*+8
  1754.  
  1755.                       $=$+8
  1756.  
  1757.       
  1758.  
  1759.       EQU. This directive can be used to  assign  values  to  labels.  The
  1760.  
  1761.       labels  can  then  be  used  in  expressions in place of the literal
  1762.  
  1763.       constant.  The format is:
  1764.  
  1765.       
  1766.  
  1767.               <label> .EQU  <expr>
  1768.  
  1769.       
  1770.  
  1771.       Here is an example:
  1772.  
  1773.       
  1774.  
  1775.               MASK    .EQU    F0H
  1776.  
  1777.               ;
  1778.  
  1779.                       lda     IN_BYTE
  1780.  
  1781.                       and     MASK
  1782.  
  1783.                       sta     OUT_BYTE
  1784.  
  1785.       
  1786.  
  1787.       An  alternate  form  of  'EQU'  is  '='.  The  previous  example  is
  1788.  
  1789.       equivalent to:
  1790.  
  1791.       
  1792.  
  1793.               MASK    =       F0H
  1794.  
  1795.       or
  1796.  
  1797.               MASK    =FOH
  1798.  
  1799.               MASK    =$FO
  1800.  
  1801.  
  1802.  
  1803.       TASM - Table Driven Assembler                                Page 16  
  1804.  
  1805.       
  1806.  
  1807.       
  1808.  
  1809.       White  space must exist after the label,  but none is required after
  1810.  
  1811.       the '='.
  1812.  
  1813.       
  1814.  
  1815.       
  1816.  
  1817.       BYTE.  This directive allows a value assignment to the byte pointed
  1818.  
  1819.       to by the current Instruction Pointer.  The format is:
  1820.  
  1821.       
  1822.  
  1823.               [<label>] .BYTE   <expr>
  1824.  
  1825.       
  1826.  
  1827.       Only the lower eight bits of <expr> are used.  Only one byte at a
  1828.  
  1829.       time may be assigned.  Here are some examples:
  1830.  
  1831.       
  1832.  
  1833.               label1  .BYTE   10010110B
  1834.  
  1835.                       .byte   'a'
  1836.  
  1837.                       .byte   0
  1838.  
  1839.       
  1840.  
  1841.       
  1842.  
  1843.       WORD. This directive allows a value assignment to the next two bytes
  1844.  
  1845.       pointed to by the current Instruction Pointer.  The format is:
  1846.  
  1847.       
  1848.  
  1849.               [<label>] .WORD  <expr>
  1850.  
  1851.       
  1852.  
  1853.       The  least  significant  byte  of  <expr>  is  put  at  the  current
  1854.  
  1855.       Instruction  Pointer  with  the  most  significant  byte at the next
  1856.  
  1857.       sequential location.  Here are some examples:
  1858.  
  1859.       
  1860.  
  1861.               data_table      .WORD   (data_table + 1)
  1862.  
  1863.                               .word   $1234
  1864.  
  1865.                               .Word   (('x' - 'a')  << 2)
  1866.  
  1867.       
  1868.  
  1869.       
  1870.  
  1871.       TEXT.  This  directive  allows  an ASCII string to be used to assign
  1872.  
  1873.       values  to  a  sequence  of  locations  starting  at   the   current
  1874.  
  1875.       Instruction Pointer.  The format is:
  1876.  
  1877.       
  1878.  
  1879.               [<label>] .TEXT   "<string>"
  1880.  
  1881.       
  1882.  
  1883.       The  ASCII value of each character in <string> is taken and assigned
  1884.  
  1885.       to the next sequential location.  Here are some examples:
  1886.  
  1887.       
  1888.  
  1889.               message1  .TEXT  "Disk I/O error"
  1890.  
  1891.               message2  .text  "Enter file name "
  1892.  
  1893.                         .text  "abcdefg"
  1894.  
  1895.       
  1896.  
  1897.       TASM  only  shows  the first four bytes of the string in the listing
  1898.  
  1899.       file, but all bytes are included in the object file.
  1900.  
  1901.       
  1902.  
  1903.       BLOCK. This directive causes the Instruction Pointer to advance  the
  1904.  
  1905.       specified  number  of  bytes without assigning values to the skipped
  1906.  
  1907.       over locations.  The format is:
  1908.  
  1909.       
  1910.  
  1911.               [<label>] .BLOCK        <expr>
  1912.  
  1913.       
  1914.  
  1915.       Some valid examples are:
  1916.  
  1917.       
  1918.  
  1919.               word1   .BLOCK  2
  1920.  
  1921.  
  1922.  
  1923.       TASM - Table Driven Assembler                                Page 17  
  1924.  
  1925.       
  1926.  
  1927.               byte1   .block  1
  1928.  
  1929.               buffer  .block  80
  1930.  
  1931.       
  1932.  
  1933.       TITLE. This directive allows the user to define a title string  that
  1934.  
  1935.       appears  at the top of each page of the list file (assuming the PAGE
  1936.  
  1937.       mode is on).  The format is:
  1938.  
  1939.       
  1940.  
  1941.                       .TITLE  "<string>"
  1942.  
  1943.       
  1944.  
  1945.       The string should not exceed 80 characters.  Here are some examples:
  1946.  
  1947.       
  1948.  
  1949.                       .TITLE  "Controller version 1.1"
  1950.  
  1951.                       .title  "This is the title of the assembly"
  1952.  
  1953.                       .title  ""
  1954.  
  1955.       
  1956.  
  1957.       
  1958.  
  1959.       LIST/NOLIST.  These directives can be used to alternately turn the
  1960.  
  1961.       output to the list file on (LIST) or off (NOLIST).  The format is:
  1962.  
  1963.       
  1964.  
  1965.               .LIST
  1966.  
  1967.               .NOLIST
  1968.  
  1969.       
  1970.  
  1971.       
  1972.  
  1973.       PAGE/NOPAGE. These directives can be used to  alternately  turn  the
  1974.  
  1975.       paging mode on (PAGE) or off (NOPAGE).  If paging is in effect, then
  1976.  
  1977.       every  sixty  lines  of  output  will  be  followed by a Top of Form
  1978.  
  1979.       character and a two line header containing  page  number,  filename,
  1980.  
  1981.       and the title.  The format is:
  1982.  
  1983.       
  1984.  
  1985.               .PAGE
  1986.  
  1987.               .NOPAGE
  1988.  
  1989.       
  1990.  
  1991.       
  1992.  
  1993.       
  1994.  
  1995.       EJECT.  This  directive  can  be used to force a Top of Form and the
  1996.  
  1997.       generation of a page header on the list file.  It has no  effect  if
  1998.  
  1999.       the paging mode is off (see PAGE/NOPAGE).  The format is:
  2000.  
  2001.       
  2002.  
  2003.               .EJECT
  2004.  
  2005.       
  2006.  
  2007.       ADDINSTR.  This  directive  can  be  used   to   define   additional
  2008.  
  2009.       instructions for TASM to use in this assembly.  The format is:
  2010.  
  2011.       
  2012.  
  2013.       [<label>]   .ADDINSTR   <inst> <args> <opcode> <nbytes> <modop> <class>
  2014.  
  2015.       
  2016.  
  2017.       The fields are separated by white space just as they would appear in an
  2018.  
  2019.       instruction definition file as described in TASM INSTRUCTION SET
  2020.  
  2021.       TABLE DEFINITION.
  2022.  
  2023.       
  2024.  
  2025.       END.   This   directive   should  follow  all  code/data  generating
  2026.  
  2027.       statements in the source file.  It forces  the  last  record  to  be
  2028.  
  2029.       written to the object file.  The format is:
  2030.  
  2031.       
  2032.  
  2033.               [<label>]       .END
  2034.  
  2035.       
  2036.  
  2037.       
  2038.  
  2039.       
  2040.  
  2041.  
  2042.  
  2043.       TASM - Table Driven Assembler                                Page 18  
  2044.  
  2045.       
  2046.  
  2047.       
  2048.  
  2049.       OBJECT FILE FORMATS
  2050.  
  2051.       
  2052.  
  2053.       TASM supports three object file formats:
  2054.  
  2055.       
  2056.  
  2057.               1.  Intel Hex (default).
  2058.  
  2059.               2.  MOS Technology Hex.
  2060.  
  2061.               3.  Binary
  2062.  
  2063.       
  2064.  
  2065.       Each are described below:
  2066.  
  2067.       
  2068.  
  2069.       
  2070.  
  2071.       
  2072.  
  2073.       Intel Hex Object Format. This is the default format.  This format is
  2074.  
  2075.       line  oriented  and  uses only printable ASCII characters except for
  2076.  
  2077.       the carriage return/line feed at the end of each line.  Each line in
  2078.  
  2079.       the file assumes the following format:
  2080.  
  2081.       
  2082.  
  2083.       :NNAAAARRHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCTT
  2084.  
  2085.       
  2086.  
  2087.       Where:
  2088.  
  2089.       
  2090.  
  2091.       All fields marked 'hex' consist of two  or  four  ASCII  hexadecimal
  2092.  
  2093.       digits  (0-9,  A-F).  A maximum of 24 data bytes will be represented
  2094.  
  2095.       on each line.
  2096.  
  2097.       
  2098.  
  2099.       :       = Record Start Character
  2100.  
  2101.       NN      = Byte Count (hex)
  2102.  
  2103.       AAAA    = Address of first byte (hex)
  2104.  
  2105.       RR      = Record Type (hex, 00 except for last record which is 01)
  2106.  
  2107.       HH      = Data Bytes (hex)
  2108.  
  2109.       CC      = Check Sum (hex)
  2110.  
  2111.       TT      = Line Terminator (carriage return, line feed)
  2112.  
  2113.       
  2114.  
  2115.       The last line of the file will be a record conforming to  the  above
  2116.  
  2117.       format with a byte count of zero (':00000001FF').
  2118.  
  2119.       
  2120.  
  2121.       The checksum is defined as:
  2122.  
  2123.       
  2124.  
  2125.               sum      =  byte_count + address_hi + address_lo +
  2126.  
  2127.                               record_type + (sum of all data bytes)
  2128.  
  2129.               checksum =  ((-sum) & ffh)
  2130.  
  2131.       
  2132.  
  2133.       
  2134.  
  2135.       
  2136.  
  2137.       
  2138.  
  2139.       
  2140.  
  2141.       
  2142.  
  2143.       
  2144.  
  2145.       
  2146.  
  2147.       
  2148.  
  2149.       
  2150.  
  2151.       
  2152.  
  2153.       
  2154.  
  2155.       
  2156.  
  2157.       
  2158.  
  2159.       
  2160.  
  2161.  
  2162.  
  2163.       TASM - Table Driven Assembler                                Page 19  
  2164.  
  2165.       
  2166.  
  2167.       
  2168.  
  2169.       MOS  Technology  Hex Object Format. This format is line oriented and
  2170.  
  2171.       uses  only  printable  ASCII  characters  except  for  the  carriage
  2172.  
  2173.       return/line  feed  at  the  end of each line.  Each line in the file
  2174.  
  2175.       assumes the following format:
  2176.  
  2177.       
  2178.  
  2179.       ;NNAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCCCTT
  2180.  
  2181.       
  2182.  
  2183.       Where:
  2184.  
  2185.       
  2186.  
  2187.       All fields marked 'hex' consist of two  or  four  ASCII  hexadecimal
  2188.  
  2189.       digits  (0-9,  A-F).  A maximum of 24 data bytes will be represented
  2190.  
  2191.       on each line.
  2192.  
  2193.       
  2194.  
  2195.       ;       = Record Start Character
  2196.  
  2197.       NN      = Byte Count (hex)
  2198.  
  2199.       AAAA    = Address of first byte (hex)
  2200.  
  2201.       HH      = Data Bytes (hex)
  2202.  
  2203.       CCCC    = Check Sum (hex)
  2204.  
  2205.       TT      = Line Terminator (carriage return, line feed)
  2206.  
  2207.       
  2208.  
  2209.       The last line of the file will be a record with a byte count of zero
  2210.  
  2211.       (';00').
  2212.  
  2213.       
  2214.  
  2215.       The checksum is defined as:
  2216.  
  2217.       
  2218.  
  2219.               sum      =  byte_count + address_hi + address_lo +
  2220.  
  2221.                               record_type + (sum of all data bytes)
  2222.  
  2223.               checksum =  (sum & ffffh)
  2224.  
  2225.       
  2226.  
  2227.       
  2228.  
  2229.       
  2230.  
  2231.       
  2232.  
  2233.       
  2234.  
  2235.       Binary   Object   Format.   This  file  format  has  only  a  binary
  2236.  
  2237.       representation of each data byte with no address, checksum or format
  2238.  
  2239.       description,  whatsoever.  It is often a convenient format to use to
  2240.  
  2241.       pass  the  data to other programs on your PC (like a PROM programmer
  2242.  
  2243.       package) but because of the  nonprintability  and  lack  of  address
  2244.  
  2245.       information,  it  is  not  often  used to transmit the code to other
  2246.  
  2247.       systems.
  2248.  
  2249.       
  2250.  
  2251.       Note that when this object format is selected (-b  option),  the  -c 
  2252.  
  2253.       option  is  forced.  This  is  done so that no ambiguity arises as a 
  2254.  
  2255.       result of the lack of address information in the file.  Without  the 
  2256.  
  2257.       -c  option,   discontinuous  blocks  of  object  code  would  appear 
  2258.  
  2259.       contiguous.  
  2260.  
  2261.       
  2262.  
  2263.       
  2264.  
  2265.       
  2266.  
  2267.       
  2268.  
  2269.       
  2270.  
  2271.       
  2272.  
  2273.       
  2274.  
  2275.       
  2276.  
  2277.       
  2278.  
  2279.       
  2280.  
  2281.  
  2282.  
  2283.       TASM - Table Driven Assembler                                Page 20  
  2284.  
  2285.       
  2286.  
  2287.       
  2288.  
  2289.       LISTING FILE FORMAT
  2290.  
  2291.       
  2292.  
  2293.       Each line of source code generates one (or more) lines of output  in
  2294.  
  2295.       the listing file.  The fields of the output line are as follows:
  2296.  
  2297.       
  2298.  
  2299.               1.  Current  source  file  line  number  (4 decimal digits).
  2300.  
  2301.       
  2302.  
  2303.               2.  An optional '+' appears if this is  an  'INCLUDE'  file.
  2304.  
  2305.                       (One '+' for each level of INCLUDE invoked).
  2306.  
  2307.       
  2308.  
  2309.               3.  Current Instruction Pointer (4 hex digits).  An optional
  2310.  
  2311.                       '~' follows the Instruction Pointer if the  line  of
  2312.  
  2313.                       source  code  is  not  being assembled because of an
  2314.  
  2315.                       IFDEF, IFNDEF, or IF directive.
  2316.  
  2317.       
  2318.  
  2319.               4.  Resulting code/data generated from this source line (two
  2320.  
  2321.                       hex digits per byte, each byte separated by a space,
  2322.  
  2323.                       up to four bytes per line).
  2324.  
  2325.       
  2326.  
  2327.               5.  The  source  line  exactly  as  it appears in the source
  2328.  
  2329.                       file.
  2330.  
  2331.       
  2332.  
  2333.       If  paging  is  enabled (by either the '-p' option flag or the .PAGE
  2334.  
  2335.       directive) some additional fields will be inserted into the  listing
  2336.  
  2337.       file every 60 lines.  These fields are:
  2338.  
  2339.       
  2340.  
  2341.               1.  Top of Form (form feed).
  2342.  
  2343.               2.  Assembler identifier (e.g. "TASM 6502 Assembler").
  2344.  
  2345.               3.  Initial source file name.
  2346.  
  2347.               4.  Page number.
  2348.  
  2349.               5.  Title.
  2350.  
  2351.       
  2352.  
  2353.       For an example of the listing file format, see appendix A.
  2354.  
  2355.       
  2356.  
  2357.       
  2358.  
  2359.       
  2360.  
  2361.       
  2362.  
  2363.       
  2364.  
  2365.       
  2366.  
  2367.       
  2368.  
  2369.       
  2370.  
  2371.       
  2372.  
  2373.       
  2374.  
  2375.       
  2376.  
  2377.       
  2378.  
  2379.       
  2380.  
  2381.       
  2382.  
  2383.       
  2384.  
  2385.       
  2386.  
  2387.       
  2388.  
  2389.       
  2390.  
  2391.       
  2392.  
  2393.       
  2394.  
  2395.       
  2396.  
  2397.       
  2398.  
  2399.       
  2400.  
  2401.  
  2402.  
  2403.       TASM - Table Driven Assembler                                Page 21  
  2404.  
  2405.       
  2406.  
  2407.       
  2408.  
  2409.       PROM PROGRAMMING
  2410.  
  2411.       
  2412.  
  2413.       A wide variety of PROM programming equipment is available  that  can
  2414.  
  2415.       use  object  code  in  one or more of the formats TASM supports.  We
  2416.  
  2417.       will not try to list all such  compatible  systems  here,  but  will
  2418.  
  2419.       mention one configuration that has worked well for us.
  2420.  
  2421.       
  2422.  
  2423.       We have used the Apparat "IBM PROM Blaster,  24 Pin" (available from
  2424.  
  2425.       Apparat Inc.,  4401 Tamarac Parkway,  Denver,  Colorado 80237, $129)
  2426.  
  2427.       for programming 24  pin  EPROMs  with  much  success.  The  software
  2428.  
  2429.       supplied  with  this  product  will accept a TASM object file in the
  2430.  
  2431.       binary  format  (-b  option  flag  on  TASM   command   line).   The
  2432.  
  2433.       combination   of  TASM  and  the  PROM  Blaster  make  for  a  truly
  2434.  
  2435.       inexpensive solution to the problem of generating  PROMed  code  for
  2436.  
  2437.       target microprocessor systems.  (STI is not affiliated or associated
  2438.  
  2439.       with Apparat in any way).
  2440.  
  2441.       
  2442.  
  2443.       
  2444.  
  2445.       
  2446.  
  2447.       Some additional notes about generating code to be put in PROMs:
  2448.  
  2449.       
  2450.  
  2451.               1.  It  is  often  desirable  to  have all bytes in the PROM
  2452.  
  2453.                       programmed even if not explicitly assigned  a  value
  2454.  
  2455.                       in the source code (e.g.  the bytes are skipped over
  2456.  
  2457.                       with a .ORG statement).  This can be accomplished by
  2458.  
  2459.                       using the -c (contiguous block) and  the  -f  (fill)
  2460.  
  2461.                       command  line option flags.  The -c will ensure that
  2462.  
  2463.                       every byte from the lowest byte assigned a value  to
  2464.  
  2465.                       the the highest byte assigned a value will be in the
  2466.  
  2467.                       object  file  with no gaps.  The -f flag will assign
  2468.  
  2469.                       the specified value to all bytes before the assembly
  2470.  
  2471.                       begins so that when the object file is written,  all
  2472.  
  2473.                       bytes  not  assigned a value in the source code will
  2474.  
  2475.                       have a known value.  As an  example,  the  following
  2476.  
  2477.                       command  line  will  generate  object  code  in  the
  2478.  
  2479.                       default Intel Hex format with all bytes not assigned
  2480.  
  2481.                       a value in the source set to EA (hex, 6502 NOP):
  2482.  
  2483.       
  2484.  
  2485.                       tasm -65 -c -fEA test.asm
  2486.  
  2487.       
  2488.  
  2489.               2.  To ensure that TASM generates object code to  cover  the
  2490.  
  2491.                       full  address  range of the target PROM,  put a .ORG
  2492.  
  2493.                       statement at the end of the source file set  to  the
  2494.  
  2495.                       last address desired.  For example, to generate code
  2496.  
  2497.                       to  be  put  in  a  2716  EPROM  (2 Kbytes) from hex
  2498.  
  2499.                       address $1000 to $17ff,  do something like  this  in
  2500.  
  2501.                       the source file:
  2502.  
  2503.       
  2504.  
  2505.                                ;start of the file
  2506.  
  2507.                                .ORG    $1000
  2508.  
  2509.                                ;rest of the source code follows
  2510.  
  2511.        
  2512.  
  2513.                                <source code>
  2514.  
  2515.        
  2516.  
  2517.                                ;end of the source code
  2518.  
  2519.                                .ORG    $17ff
  2520.  
  2521.  
  2522.  
  2523.       TASM - Table Driven Assembler                                Page 22  
  2524.  
  2525.       
  2526.  
  2527.                                .BYTE   0
  2528.  
  2529.                                .END
  2530.  
  2531.       
  2532.  
  2533.                       Now,  to  invoke  TASM  to  generate the code in the
  2534.  
  2535.                       binary format with all unassigned bytes  set  to  00
  2536.  
  2537.                       (6502 BRK), do the following:
  2538.  
  2539.       
  2540.  
  2541.                       tasm -65 -b -f00 test.asm
  2542.  
  2543.       
  2544.  
  2545.                       Note that -b forces the -c option.
  2546.  
  2547.       
  2548.  
  2549.       
  2550.  
  2551.       
  2552.  
  2553.       
  2554.  
  2555.       
  2556.  
  2557.       
  2558.  
  2559.       
  2560.  
  2561.       
  2562.  
  2563.       
  2564.  
  2565.       
  2566.  
  2567.       
  2568.  
  2569.       
  2570.  
  2571.       
  2572.  
  2573.       
  2574.  
  2575.       
  2576.  
  2577.       
  2578.  
  2579.       
  2580.  
  2581.       
  2582.  
  2583.       
  2584.  
  2585.       
  2586.  
  2587.       
  2588.  
  2589.       
  2590.  
  2591.       
  2592.  
  2593.       
  2594.  
  2595.       
  2596.  
  2597.       
  2598.  
  2599.       
  2600.  
  2601.       
  2602.  
  2603.       
  2604.  
  2605.       
  2606.  
  2607.       
  2608.  
  2609.       
  2610.  
  2611.       
  2612.  
  2613.       
  2614.  
  2615.       
  2616.  
  2617.       
  2618.  
  2619.       
  2620.  
  2621.       
  2622.  
  2623.       
  2624.  
  2625.       
  2626.  
  2627.       
  2628.  
  2629.       
  2630.  
  2631.       
  2632.  
  2633.       
  2634.  
  2635.       
  2636.  
  2637.       
  2638.  
  2639.       
  2640.  
  2641.  
  2642.  
  2643.       TASM - Table Driven Assembler                                Page 23  
  2644.  
  2645.       
  2646.  
  2647.       
  2648.  
  2649.       ERROR MESSAGES
  2650.  
  2651.       
  2652.  
  2653.       
  2654.  
  2655.       Error Message                           Description
  2656.  
  2657.       --------------------------------------------------------
  2658.  
  2659.       unrecognized directive..................A statement starting  with a
  2660.  
  2661.                                               '.'  or  '#'  has a mnemonic
  2662.  
  2663.                                               that is  not  defined  as  a
  2664.  
  2665.                                               directive.
  2666.  
  2667.       
  2668.  
  2669.       unrecognized  instruction...............A  statement  has  an opcode
  2670.  
  2671.                                               mnemonic   that    is    not
  2672.  
  2673.                                               defined.
  2674.  
  2675.       
  2676.  
  2677.       unrecognized argument...................A statement has  an  operand
  2678.  
  2679.                                               format that is not defined.
  2680.  
  2681.       
  2682.  
  2683.       label value misaligned..................The value of a label appears
  2684.  
  2685.                                               to have a different value on
  2686.  
  2687.                                               the  second pass then it was
  2688.  
  2689.                                               computed  to  have  on   the
  2690.  
  2691.                                               first    pass.    This    is
  2692.  
  2693.                                               generally due to  Zero  Page
  2694.  
  2695.                                               Addressing   mode   problems
  2696.  
  2697.                                               with  the  6502  version  of
  2698.  
  2699.                                               TASM.  Labels  that are used
  2700.  
  2701.                                               in operands  for  statements
  2702.  
  2703.                                               that   could  utilized  Zero
  2704.  
  2705.                                               Page addressing mode  should
  2706.  
  2707.                                               always   be  defined  before
  2708.  
  2709.                                               used as an operand.
  2710.  
  2711.       
  2712.  
  2713.       label table overflow....................To  many  labels  have  been
  2714.  
  2715.                                               encountered.
  2716.  
  2717.       
  2718.  
  2719.       No END directive before EOF.............The source file did not have
  2720.  
  2721.                                               an   END  directive  in  it.
  2722.  
  2723.                                               This is not fatal,  but  may
  2724.  
  2725.                                               cause  the  last object file
  2726.  
  2727.                                               record to be lost.
  2728.  
  2729.       
  2730.  
  2731.       No  files  specified....................TASM  was  invoked  with  no
  2732.  
  2733.                                               source file specified.
  2734.  
  2735.       
  2736.  
  2737.       Unknown  option  flag...................TASM  was  invoked  with  an
  2738.  
  2739.                                               undefined option flag on the
  2740.  
  2741.                                               command line.
  2742.  
  2743.       
  2744.  
  2745.       Source file open error..................TASM was not  able  to  open
  2746.  
  2747.                                               the specified source file.
  2748.  
  2749.       
  2750.  
  2751.       List file open error....................TASM was not  able  to  open
  2752.  
  2753.                                               the specified list file.
  2754.  
  2755.       
  2756.  
  2757.       Object file open error..................TASM was not  able  to  open
  2758.  
  2759.                                               the specified object file.
  2760.  
  2761.  
  2762.  
  2763.       TASM - Table Driven Assembler                                Page 24  
  2764.  
  2765.       
  2766.  
  2767.       
  2768.  
  2769.       Unknown token...........................Unexpected  characters  were
  2770.  
  2771.                                               encountered while parsing an
  2772.  
  2773.                                               expression.
  2774.  
  2775.       
  2776.  
  2777.       maximum number of macros exceeded.......To  many  macros   (DEFINEs)
  2778.  
  2779.                                               have been encountered.
  2780.  
  2781.       
  2782.  
  2783.       macro buffer overflow...................The buffer from which  space
  2784.  
  2785.                                               is   allocated   for   macro
  2786.  
  2787.                                               definitions is exhausted.
  2788.  
  2789.       
  2790.  
  2791.       range of relative branch exceeded.......A branch instruction exceeds
  2792.  
  2793.                                               the  maximum   range   (6502
  2794.  
  2795.                                               Version).
  2796.  
  2797.       
  2798.  
  2799.       
  2800.  
  2801.       
  2802.  
  2803.       
  2804.  
  2805.       
  2806.  
  2807.       
  2808.  
  2809.       
  2810.  
  2811.       
  2812.  
  2813.       
  2814.  
  2815.       
  2816.  
  2817.       
  2818.  
  2819.       
  2820.  
  2821.       
  2822.  
  2823.       
  2824.  
  2825.       
  2826.  
  2827.       
  2828.  
  2829.       
  2830.  
  2831.       
  2832.  
  2833.       
  2834.  
  2835.       
  2836.  
  2837.       
  2838.  
  2839.       
  2840.  
  2841.       
  2842.  
  2843.       
  2844.  
  2845.       
  2846.  
  2847.       
  2848.  
  2849.       
  2850.  
  2851.       
  2852.  
  2853.       
  2854.  
  2855.       
  2856.  
  2857.       
  2858.  
  2859.       
  2860.  
  2861.       
  2862.  
  2863.       
  2864.  
  2865.       
  2866.  
  2867.       
  2868.  
  2869.       
  2870.  
  2871.       
  2872.  
  2873.       
  2874.  
  2875.       
  2876.  
  2877.       
  2878.  
  2879.       
  2880.  
  2881.  
  2882.  
  2883.       TASM - Table Driven Assembler                                Page 25  
  2884.  
  2885.       
  2886.  
  2887.       
  2888.  
  2889.       BUGS AND LIMITATIONS
  2890.  
  2891.       
  2892.  
  2893.       Limitations and Specifications
  2894.  
  2895.       ----------------------------------------------------------------
  2896.  
  2897.       Maximum number of labels                2000
  2898.  
  2899.       Maximum length of labels                13 characters
  2900.  
  2901.       Maximum address space                   64 Kbytes (65536 bytes)
  2902.  
  2903.       Maximum number of nested INCLUDES       6
  2904.  
  2905.       Maximum length of TITLE string          79 characters
  2906.  
  2907.       Maximum Source line length              255 characters
  2908.  
  2909.       Maximum length of expressions           255 characters
  2910.  
  2911.       Maximum length of pathnames             79 characters
  2912.  
  2913.       Maximum length of command line          127 characters
  2914.  
  2915.       
  2916.  
  2917.       Maximum number of macros                1000
  2918.  
  2919.       Maximum number of macro arguments       10
  2920.  
  2921.       Maximum length of macro argument        16 characters
  2922.  
  2923.       Heap size (for labels and macros)       20000 bytes
  2924.  
  2925.       
  2926.  
  2927.       Memory requirements                     160K (32K for code, 64K for
  2928.  
  2929.                                               data and stack, 64K for
  2930.  
  2931.                                               opcode memory image*).
  2932.  
  2933.       
  2934.  
  2935.       
  2936.  
  2937.       *Note that TASM uses the 64 Kbyte segment immediately following  the
  2938.  
  2939.       data/stack  segment to store assembled opcodes and data before being
  2940.  
  2941.       written to the object file.
  2942.  
  2943.       
  2944.  
  2945.       
  2946.  
  2947.       Bugs
  2948.  
  2949.       
  2950.  
  2951.       1.  The 8048 version of TASM does not check for use of memory beyond
  2952.  
  2953.               any  reasonable  bounds (e.g.  an 8048 has a maximum address
  2954.  
  2955.               space of 4 Kbytes but TASM will let  you  pretend  that  you
  2956.  
  2957.               have 64 Kbytes).
  2958.  
  2959.       
  2960.  
  2961.       2.  Expression evaluation has no operator precedence in effect which
  2962.  
  2963.               can  make  for  unexpected results if not explicitly grouped
  2964.  
  2965.               with parenthesis.
  2966.  
  2967.       
  2968.  
  2969.       3.  First  page  of  listing file will not show a user defined title
  2970.  
  2971.               (defined via TITLE directive).
  2972.  
  2973.       
  2974.  
  2975.       4.  TASM sometimes does not generate error messages  for  improperly
  2976.  
  2977.               formed expressions.
  2978.  
  2979.       
  2980.  
  2981.       5.  TASM expands macros in comments at the end of a line (but not in
  2982.  
  2983.               lines that are all comment).
  2984.  
  2985.       
  2986.  
  2987.       6.  TASM does not generate an error message when a EQU directive has
  2988.  
  2989.               an undefined label on the right hand side.
  2990.  
  2991.       
  2992.  
  2993.       
  2994.  
  2995.       
  2996.  
  2997.       
  2998.  
  2999.       
  3000.  
  3001.  
  3002.  
  3003.       TASM - Table Driven Assembler                                Page 26  
  3004.  
  3005.       
  3006.  
  3007.       
  3008.  
  3009.       6502 INSTRUCTIONS AND ADDRESSING MODES
  3010.  
  3011.       
  3012.  
  3013.       The acceptable 6502 opcode mnemonics for TASM are as follows:
  3014.  
  3015.       
  3016.  
  3017.                ADC  AND  ASL  BCC  BCS  BEQ  BNE  BMI  BPL  BVC  BVS  BIT
  3018.  
  3019.                BRK  CLC  CLD  CLI  CLV  CMP  CPX  CPY  DEC  DEX  DEY  EOR
  3020.  
  3021.                INC  INX  INY  JMP  JSR  LDA  LDX  LDY  LSR  NOP  ORA  PHA
  3022.  
  3023.                PHP  PLA  PLP  ROL  ROR  RTI  RTS  SBC  SEC  SED  SEI  STA
  3024.  
  3025.                STX  STY  TAX  TAY  TSX  TXA  TXS  TYA
  3026.  
  3027.       
  3028.  
  3029.       TASM  also  supports the following instructions that are part of the
  3030.  
  3031.       Rockwell  R65C02  and  R65C00/21  microprocessor  instruction  sets.
  3032.  
  3033.       Those  that  are  marked  as  set A are applicable to the R65C02 and
  3034.  
  3035.       those marked as set B are  applicable  to  the  R65C00/21  (A+B  for
  3036.  
  3037.       both):
  3038.  
  3039.       
  3040.  
  3041.               Mnemonic        Description                Address Mode  Set
  3042.  
  3043.               ---------------------------------------------------------------
  3044.  
  3045.               ADC             Add with carry             (IND)         A
  3046.  
  3047.               AND             And memory with A          (IND)         A
  3048.  
  3049.               BIT             Test memory bits with A    ABS,X         A
  3050.  
  3051.               BIT             Test memory bits with A    ZP,X          A
  3052.  
  3053.               BIT             Test memory bits with A    IMM           A
  3054.  
  3055.               CMP             Compare memory with A      (IND)         A
  3056.  
  3057.               DEC             Decrement A                A             A
  3058.  
  3059.               EOR             Exclusive OR memory with A (IND)         A
  3060.  
  3061.               INC             Increment A                A             A
  3062.  
  3063.               JMP             Jump                       (ABS,X)       A
  3064.  
  3065.               LDA             Load A with memory         (IND)         A
  3066.  
  3067.               ORA             OR A with memory           (IND)         A
  3068.  
  3069.               SBC             Subtract memory form A     (IND)         A
  3070.  
  3071.               STA             Store A in memory          (IND)         A
  3072.  
  3073.               STZ             Store zero                 ABS           A
  3074.  
  3075.               STZ             Store zero                 ABS,X         A
  3076.  
  3077.               STZ             Store zero                 ZP            A
  3078.  
  3079.               STZ             Store zero                 ZP,X          A
  3080.  
  3081.               TRB             Test and reset memory bit  ABS           A
  3082.  
  3083.               TRB             Test and reset memory bit  ZP            A
  3084.  
  3085.               TSB             Test and set memory bit    ABS           A
  3086.  
  3087.               TSB             Test and set memory bit    ZP            A
  3088.  
  3089.       
  3090.  
  3091.               BRA             Branch Always              REL           A+B
  3092.  
  3093.       
  3094.  
  3095.               BBR0            Branch on Bit 0 Reset      ZP,REL        A+B
  3096.  
  3097.               BBR1            Branch on Bit 1 Reset      ZP,REL        A+B
  3098.  
  3099.               BBR2            Branch on Bit 2 Reset      ZP,REL        A+B
  3100.  
  3101.               BBR3            Branch on Bit 3 Reset      ZP,REL        A+B
  3102.  
  3103.               BBR4            Branch on Bit 4 Reset      ZP,REL        A+B
  3104.  
  3105.               BBR5            Branch on Bit 5 Reset      ZP,REL        A+B
  3106.  
  3107.               BBR6            Branch on Bit 6 Reset      ZP,REL        A+B
  3108.  
  3109.               BBR7            Branch on Bit 7 Reset      ZP,REL        A+B
  3110.  
  3111.       
  3112.  
  3113.               BBS0            Branch on Bit 0 Set        ZP,REL        A+B
  3114.  
  3115.               BBS1            Branch on Bit 1 Set        ZP,REL        A+B
  3116.  
  3117.               BBS2            Branch on Bit 2 Set        ZP,REL        A+B
  3118.  
  3119.               BBS3            Branch on Bit 3 Set        ZP,REL        A+B
  3120.  
  3121.  
  3122.  
  3123.       TASM - Table Driven Assembler                                Page 27  
  3124.  
  3125.       
  3126.  
  3127.               BBS4            Branch on Bit 4 Set        ZP,REL        A+B
  3128.  
  3129.               BBS5            Branch on Bit 5 Set        ZP,REL        A+B
  3130.  
  3131.               BBS6            Branch on Bit 6 Set        ZP,REL        A+B
  3132.  
  3133.               BBS7            Branch on Bit 7 Set        ZP,REL        A+B
  3134.  
  3135.       
  3136.  
  3137.               MUL             Multiply                   Implied       B
  3138.  
  3139.       
  3140.  
  3141.               PHX             Push Index X               Implied       A+B
  3142.  
  3143.               PHY             Push Index Y               Implied       A+B
  3144.  
  3145.               PLX             Pull Index X               Implied       A+B
  3146.  
  3147.               PLY             Pull Index Y               Implied       A+B
  3148.  
  3149.       
  3150.  
  3151.               RMB0            Reset Memory Bit 0         ZP            A+B
  3152.  
  3153.               RMB1            Reset Memory Bit 1         ZP            A+B
  3154.  
  3155.               RMB2            Reset Memory Bit 2         ZP            A+B
  3156.  
  3157.               RMB3            Reset Memory Bit 3         ZP            A+B
  3158.  
  3159.               RMB4            Reset Memory Bit 4         ZP            A+B
  3160.  
  3161.               RMB5            Reset Memory Bit 5         ZP            A+B
  3162.  
  3163.               RMB6            Reset Memory Bit 6         ZP            A+B
  3164.  
  3165.               RMB7            Reset Memory Bit 7         ZP            A+B
  3166.  
  3167.       
  3168.  
  3169.               SMB0            Set   Memory Bit 0         ZP            A+B
  3170.  
  3171.               SMB1            Set   Memory Bit 1         ZP            A+B
  3172.  
  3173.               SMB2            Set   Memory Bit 2         ZP            A+B
  3174.  
  3175.               SMB3            Set   Memory Bit 3         ZP            A+B
  3176.  
  3177.               SMB4            Set   Memory Bit 4         ZP            A+B
  3178.  
  3179.               SMB5            Set   Memory Bit 5         ZP            A+B
  3180.  
  3181.               SMB6            Set   Memory Bit 6         ZP            A+B
  3182.  
  3183.               SMB7            Set   Memory Bit 7         ZP            A+B
  3184.  
  3185.       
  3186.  
  3187.       Note that correct assembly of these extended  instructions  has  not
  3188.  
  3189.       been tested on a target system.
  3190.  
  3191.       
  3192.  
  3193.       Addressing  modes  are denoted as follows:
  3194.  
  3195.       
  3196.  
  3197.               ABS               Absolute
  3198.  
  3199.               ZP                Zero Page
  3200.  
  3201.               ABS,X             Absolute X
  3202.  
  3203.               ZP,X              Zero Page X
  3204.  
  3205.               ABS,Y             Absolute Y
  3206.  
  3207.               ZP,Y              Zero Page Y
  3208.  
  3209.               A                 Accumulator
  3210.  
  3211.               (IND,X)           Indirect X
  3212.  
  3213.               (IND),Y           Indirect Y
  3214.  
  3215.               (IND)             Indirect
  3216.  
  3217.               #IMM              Immediate
  3218.  
  3219.               REL               Relative (Branch instructions only)
  3220.  
  3221.               ZP,REL            Zero Page, Relative
  3222.  
  3223.               Implied           Implied
  3224.  
  3225.       
  3226.  
  3227.       Note  that Zero Page addressing can not be explicitly requested.  It
  3228.  
  3229.       is used if the value of the operand is  representable  in  a  single
  3230.  
  3231.       byte for the applicable statements.
  3232.  
  3233.       
  3234.  
  3235.       The '-x' command line option can be  used  to  enable  the  extended
  3236.  
  3237.       instructions.  A  '-x'  with  no  digit  following  will  enable the
  3238.  
  3239.       standard set plus both extended sets.  The 6502 version of TASM uses
  3240.  
  3241.  
  3242.  
  3243.       TASM - Table Driven Assembler                                Page 28  
  3244.  
  3245.       
  3246.  
  3247.       three bits in the instruction class  mask  to  determine  whether  a
  3248.  
  3249.       given  instruction  is enabled or not.  Bit 0 enables the basic set,
  3250.  
  3251.       bit 1 enables set A (R65C02) and bit 2 enables  set  B  (R65C00/21).
  3252.  
  3253.       The following table shows various options:
  3254.  
  3255.       
  3256.  
  3257.               Class Mask        Enabled Instructions
  3258.  
  3259.                               BASIC   R65C02  R65C00/21
  3260.  
  3261.               --------------------------------------------
  3262.  
  3263.               1               yes     no      no
  3264.  
  3265.               2               no      yes     no
  3266.  
  3267.               3               yes     yes     no
  3268.  
  3269.               4               no      no      yes
  3270.  
  3271.               5               yes     no      yes
  3272.  
  3273.               6               no      yes     yes
  3274.  
  3275.               7               yes     yes     yes
  3276.  
  3277.       
  3278.  
  3279.       Thus,  to enable the basic set plus the R65C02 instructions,  invoke
  3280.  
  3281.       the '-x3' command line option.
  3282.  
  3283.       
  3284.  
  3285.       See manufacturer's data for  a  more  complete  description  of  the
  3286.  
  3287.       meaning of the mnemonics and addressing modes.
  3288.  
  3289.       
  3290.  
  3291.       
  3292.  
  3293.       
  3294.  
  3295.       
  3296.  
  3297.       
  3298.  
  3299.       
  3300.  
  3301.       
  3302.  
  3303.       
  3304.  
  3305.       
  3306.  
  3307.       
  3308.  
  3309.       
  3310.  
  3311.       
  3312.  
  3313.       
  3314.  
  3315.       
  3316.  
  3317.       
  3318.  
  3319.       
  3320.  
  3321.       
  3322.  
  3323.       
  3324.  
  3325.       
  3326.  
  3327.       
  3328.  
  3329.       
  3330.  
  3331.       
  3332.  
  3333.       
  3334.  
  3335.       
  3336.  
  3337.       
  3338.  
  3339.       
  3340.  
  3341.       
  3342.  
  3343.       
  3344.  
  3345.       
  3346.  
  3347.       
  3348.  
  3349.       
  3350.  
  3351.       
  3352.  
  3353.       
  3354.  
  3355.       
  3356.  
  3357.       
  3358.  
  3359.       
  3360.  
  3361.  
  3362.  
  3363.       TASM - Table Driven Assembler                                Page 29  
  3364.  
  3365.       
  3366.  
  3367.       
  3368.  
  3369.       8048 INSTRUCTIONS AND ADDRESSING MODES
  3370.  
  3371.       
  3372.  
  3373.       The following list shows the acceptable opcode mnemonics  and  their
  3374.  
  3375.       corresponding  operand  formats for the 8048 version of TASM.  Where
  3376.  
  3377.       'Rn' is seen,  R0 through R7  may  be  substituted.  Other  symbolic
  3378.  
  3379.       fields are as follows:
  3380.  
  3381.       
  3382.  
  3383.               SYMBOLIC            DESCRIPTION
  3384.  
  3385.               -----------------------------------------------
  3386.  
  3387.               <addr8>             Absolute address (8 bits)
  3388.  
  3389.               <addr11>            Absolute address (11 bits)
  3390.  
  3391.               <immed>             Immediate data
  3392.  
  3393.       
  3394.  
  3395.       Any valid TASM expression can appear in the  place  of  any  of  the
  3396.  
  3397.       above symbolics.
  3398.  
  3399.       
  3400.  
  3401.       The lines that are marked with an (8041),  (8022),  or (8021) on the
  3402.  
  3403.       far  right are extended instructions that are available only if a -x
  3404.  
  3405.       option has  been  invoked  on  the  command  line.  The  classes  of
  3406.  
  3407.       instructions  (and their bit assignment in the class mask) are shown
  3408.  
  3409.       below:
  3410.  
  3411.       
  3412.  
  3413.               BIT     PROCESSOR
  3414.  
  3415.               -------------------------------
  3416.  
  3417.               0       8X48, 8035, 8039, 8049
  3418.  
  3419.               1       8X41A
  3420.  
  3421.               2       8022
  3422.  
  3423.               3       8021
  3424.  
  3425.       
  3426.  
  3427.       Thus, to enable the basic 8048 set plus the 8022 set, a -x5 could be
  3428.  
  3429.       used on the command line.
  3430.  
  3431.       
  3432.  
  3433.       Note that some of the base instructions should be disabled  for  the
  3434.  
  3435.       8041, 8022, and 8021, but are not.
  3436.  
  3437.       
  3438.  
  3439.       OPCODE  OPERANDS        DESCRIPTION
  3440.  
  3441.       -------------------------------------------------------------------
  3442.  
  3443.       ADD     A,Rn            Add Register to Acc
  3444.  
  3445.       ADD     A,@R0           Add Indirect RAM to Acc
  3446.  
  3447.       ADD     A,@R1           Add Indirect RAM to Acc
  3448.  
  3449.       ADD     A,#<immed>      Add Immediate data to Acc
  3450.  
  3451.       
  3452.  
  3453.       ADDC    A,Rn            Add Register to Acc with carry
  3454.  
  3455.       ADDC    A,@R0           Add Indirect RAM to Acc with carry
  3456.  
  3457.       ADDC    A,@R1           Add Indirect RAM to Acc with carry
  3458.  
  3459.       ADDC    A,#<immed>      Add Immediate data to Acc with carry
  3460.  
  3461.       
  3462.  
  3463.       ANL     A,Rn            AND Register to Acc
  3464.  
  3465.       ANL     A,@R0           AND Indirect RAM to Acc
  3466.  
  3467.       ANL     A,@R1           AND Indirect RAM to Acc
  3468.  
  3469.       ANL     A,#<immed>      AND Immediate data to Acc
  3470.  
  3471.       ANL     BUS,#<immed>    AND Immediate data to BUS
  3472.  
  3473.       ANL     P1,#<immed>     AND Immediate data to port P1
  3474.  
  3475.       ANL     P2,#<immed>     AND Immediate data to port P2
  3476.  
  3477.       
  3478.  
  3479.       ANLD    P4,A            AND Acc to Expander port P4
  3480.  
  3481.  
  3482.  
  3483.       TASM - Table Driven Assembler                                Page 30  
  3484.  
  3485.       
  3486.  
  3487.       ANLD    P5,A            AND Acc to Expander port P5
  3488.  
  3489.       ANLD    P6,A            AND Acc to Expander port P6
  3490.  
  3491.       ANLD    P7,A            AND Acc to Expander port P7
  3492.  
  3493.       
  3494.  
  3495.       CALL    <addr11>        Call subroutine
  3496.  
  3497.       
  3498.  
  3499.       CLR     A               Clear Acc
  3500.  
  3501.       CLR     C               Clear Carry
  3502.  
  3503.       CLR     F0              Clear Flag 0
  3504.  
  3505.       CLR     F1              Clear Flag 1
  3506.  
  3507.       
  3508.  
  3509.       CPL     A               Complement Acc
  3510.  
  3511.       CPL     C               Complement Carry
  3512.  
  3513.       CPL     F0              Complement Flag F0
  3514.  
  3515.       CPL     F1              Complement Flag F1
  3516.  
  3517.       
  3518.  
  3519.       DA      A               Decimal adjust Acc
  3520.  
  3521.       
  3522.  
  3523.       DEC     A               Decrement Acc
  3524.  
  3525.       DEC     Rn              Decrement Register
  3526.  
  3527.       
  3528.  
  3529.       DIS     I               Disable Interrupts
  3530.  
  3531.       DIS     TCNTI           Disable Timer/Counter Interrupt
  3532.  
  3533.       
  3534.  
  3535.       DJNZ    Rn,<addr8>      Decrement Register and Jump if nonzero
  3536.  
  3537.       
  3538.  
  3539.       EN      DMA             Enable DMA                           (8041)
  3540.  
  3541.       EN      FLAGS           Enable Flags                         (8041)
  3542.  
  3543.       EN      I               Enable External Interrupt
  3544.  
  3545.       EN      TCNTI           Enable Timer/Counter Interrupt
  3546.  
  3547.       ENT0    CLK             Enable Clock Output
  3548.  
  3549.       
  3550.  
  3551.       IN      A,DBB           Input Data Bus to Acc                (8041)
  3552.  
  3553.       IN      A,P0            Input Port 0 to Acc                  (8021)
  3554.  
  3555.       IN      A,P1            Input Port 1 to Acc
  3556.  
  3557.       IN      A,P2            Input Port 2 to Acc
  3558.  
  3559.       
  3560.  
  3561.       INC     A               Increment Acc
  3562.  
  3563.       INC     Rn              Increment Register
  3564.  
  3565.       INC     @R0             Increment Indirect RAM
  3566.  
  3567.       INC     @R1             Increment Indirect RAM
  3568.  
  3569.       
  3570.  
  3571.       INS     A,BUS           Strobed Input of Bus to Acc
  3572.  
  3573.       
  3574.  
  3575.       JB0     <addr8>         Jump if Acc bit 0 is set
  3576.  
  3577.       JB1     <addr8>         Jump if Acc bit 1 is set
  3578.  
  3579.       JB2     <addr8>         Jump if Acc bit 2 is set
  3580.  
  3581.       JB3     <addr8>         Jump if Acc bit 3 is set
  3582.  
  3583.       JB4     <addr8>         Jump if Acc bit 4 is set
  3584.  
  3585.       JB5     <addr8>         Jump if Acc bit 5 is set
  3586.  
  3587.       JB6     <addr8>         Jump if Acc bit 6 is set
  3588.  
  3589.       JB7     <addr8>         Jump if Acc bit 7 is set
  3590.  
  3591.       JMP     <addr11>        Jump
  3592.  
  3593.       JC      <addr8>         Jump if Carry is set
  3594.  
  3595.       JF0     <addr8>         Jump if Flag F0 is set
  3596.  
  3597.       JF1     <addr8>         Jump if Flag F1 is set
  3598.  
  3599.       JNC     <addr8>         Jump if Carry is clear
  3600.  
  3601.  
  3602.  
  3603.       TASM - Table Driven Assembler                                Page 31  
  3604.  
  3605.       
  3606.  
  3607.       JNI     <addr8>         Jump if Interrupt input is clear
  3608.  
  3609.       JNIBF   <addr8>         Jump if IBF is clear                 (8041)
  3610.  
  3611.       JNT0    <addr8>         Jump if T0 is clear
  3612.  
  3613.       JNT1    <addr8>         Jump if T1 is clear
  3614.  
  3615.       JNZ     <addr8>         Jump if Acc is not zero
  3616.  
  3617.       JOBF    <addr8>         Jump if OBF is set                   (8041)
  3618.  
  3619.       JTF     <addr8>         Jump if Timer Flag is set
  3620.  
  3621.       JT0     <addr8>         Jump if T0 pin is high
  3622.  
  3623.       JT1     <addr8>         Jump if T1 pin is high
  3624.  
  3625.       JZ      <addr8>         Jump if Acc is zero
  3626.  
  3627.       JMPP    @A              Jump Indirect (current page)
  3628.  
  3629.       
  3630.  
  3631.       MOV     A,PSW           Move PSW to Acc
  3632.  
  3633.       MOV     A,Rn            Move Register to Acc
  3634.  
  3635.       MOV     A,T             Move Timer/Counter to Acc
  3636.  
  3637.       MOV     A,@R0           Move Indirect RAM to Acc
  3638.  
  3639.       MOV     A,@R1           Move Indirect RAM to Acc
  3640.  
  3641.       MOV     A,#<immed>      Move Immediate data to Acc
  3642.  
  3643.       MOV     PSW,A           Move Acc to PSW
  3644.  
  3645.       MOV     Rn,A            Move Acc to Register
  3646.  
  3647.       MOV     Rn,#<immed>     Move Immediate data to Register
  3648.  
  3649.       MOV     STS,A           Move Acc to STS                      (8041)
  3650.  
  3651.       MOV     T,A             Move Acc to Timer/Counter
  3652.  
  3653.       MOV     @R0,A           Move Acc to Indirect RAM
  3654.  
  3655.       MOV     @R1,A           Move Acc to Indirect RAM
  3656.  
  3657.       MOV     @R0,#<immed>    Move Immediate data to Indirect RAM
  3658.  
  3659.       MOV     @R1,#<immed>    Move Immediate data to Indirect RAM
  3660.  
  3661.       
  3662.  
  3663.       MOVD    A,P4            Move half-byte Port 4 to Acc (lower nibble)
  3664.  
  3665.       MOVD    A,P5            Move half-byte Port 5 to Acc (lower nibble)
  3666.  
  3667.       MOVD    A,P6            Move half-byte Port 6 to Acc (lower nibble)
  3668.  
  3669.       MOVD    A,P7            Move half-byte Port 7 to Acc (lower nibble)
  3670.  
  3671.       MOVD    P4,A            Move lower nibble of Acc to Port 4
  3672.  
  3673.       MOVD    P5,A            Move lower nibble of Acc to Port 5
  3674.  
  3675.       MOVD    P6,A            Move lower nibble of Acc to Port 6
  3676.  
  3677.       MOVD    P7,A            Move lower nibble of Acc to Port 7
  3678.  
  3679.       
  3680.  
  3681.       MOVP    A,@A            Move Indirect Program data to Acc
  3682.  
  3683.       MOVP3   A,@A            Move Indirect Program data to Acc (page 3)
  3684.  
  3685.       
  3686.  
  3687.       MOVX    A,@R0           Move Indirect External RAM to Acc
  3688.  
  3689.       MOVX    A,@R1           Move Indirect External RAM to Acc
  3690.  
  3691.       MOVX    @R0,A           Move Acc to Indirect External RAM
  3692.  
  3693.       MOVX    @R1,A           Move Acc to Indirect External RAM
  3694.  
  3695.       
  3696.  
  3697.       NOP                     No operation
  3698.  
  3699.       
  3700.  
  3701.       ORL     A,Rn            OR Register to Acc
  3702.  
  3703.       ORL     A,@R0           OR Indirect RAM to Acc
  3704.  
  3705.       ORL     A,@R1           OR Indirect RAM to Acc
  3706.  
  3707.       ORL     A,#<immed>      OR Immediate data to Acc
  3708.  
  3709.       ORL     BUS,#<immed>    OR Immediate data to BUS
  3710.  
  3711.       ORL     P1,#<immed>     OR Immediate data to port P1
  3712.  
  3713.       ORL     P2,#<immed>     OR Immediate data to port P2
  3714.  
  3715.       
  3716.  
  3717.       ORLD    P4,A            OR lower nibble of Acc with P4
  3718.  
  3719.       ORLD    P5,A            OR lower nibble of Acc with P5
  3720.  
  3721.  
  3722.  
  3723.       TASM - Table Driven Assembler                                Page 32  
  3724.  
  3725.       
  3726.  
  3727.       ORLD    P6,A            OR lower nibble of Acc with P6
  3728.  
  3729.       ORLD    P7,A            OR lower nibble of Acc with P7
  3730.  
  3731.       
  3732.  
  3733.       OUTL    BUS,A           Output Acc to Bus
  3734.  
  3735.       OUT     DBB,A           Output Acc to DBB                    (8041)
  3736.  
  3737.       OUTL    P0,A            Output Acc to Port P0                (8021)
  3738.  
  3739.       OUTL    P1,A            Output Acc to Port P1
  3740.  
  3741.       OUTL    P2,A            Output Acc to Port P2
  3742.  
  3743.       
  3744.  
  3745.       RAD                     Move A/D Converter to Acc            (8022)
  3746.  
  3747.       
  3748.  
  3749.       RET                     Return from subroutine
  3750.  
  3751.       RETI                    Return from Interrupt w/o PSW restore(8022)
  3752.  
  3753.       RETR                    Return from Interrupt w/  PSW restore
  3754.  
  3755.       
  3756.  
  3757.       RL      A               Rotate Acc Left
  3758.  
  3759.       RLC     A               Rotate Acc Left through Carry
  3760.  
  3761.       RR      A               Rotate Acc Right
  3762.  
  3763.       RRC     A               Rotate Acc Right through Carry
  3764.  
  3765.       
  3766.  
  3767.       SEL     AN0             Select Analog Input 0                (8022)
  3768.  
  3769.       SEL     AN1             Select Analog Input 1                (8022)
  3770.  
  3771.       SEL     MB0             Select Memory Bank 0
  3772.  
  3773.       SEL     MB1             Select Memory Bank 1
  3774.  
  3775.       SEL     RB0             Select Register Bank 0
  3776.  
  3777.       SEL     RB1             Select Register Bank 1
  3778.  
  3779.       
  3780.  
  3781.       STOP    TCNT            Stop Timer/Counter
  3782.  
  3783.       STRT    CNT             Start Counter
  3784.  
  3785.       STRT    T               Start Timer
  3786.  
  3787.       
  3788.  
  3789.       SWAP    A               Swap nibbles of Acc
  3790.  
  3791.       
  3792.  
  3793.       XCH     A,Rn            Exchange Register with Acc
  3794.  
  3795.       XCH     A,@R0           Exchange Indirect RAM with Acc
  3796.  
  3797.       XCH     A,@R1           Exchange Indirect RAM with Acc
  3798.  
  3799.       
  3800.  
  3801.       XCHD    A,@R0           Exchange lower nibble of Indirect RAM w/ Acc
  3802.  
  3803.       XCHD    A,@R1           Exchange lower nibble of Indirect RAM w/ Acc
  3804.  
  3805.       
  3806.  
  3807.       XRL     A,Rn            Exclusive OR Register to Acc
  3808.  
  3809.       XRL     A,@R0           Exclusive OR Indirect RAM to Acc
  3810.  
  3811.       XRL     A,@R1           Exclusive OR Indirect RAM to Acc
  3812.  
  3813.       XRL     A,#<immed>      Exclusive OR Immediate data to Acc
  3814.  
  3815.       
  3816.  
  3817.       
  3818.  
  3819.       See manufacturer's data for  a  more  complete  description  of  the
  3820.  
  3821.       meaning of the mnemonics and addressing modes.
  3822.  
  3823.       
  3824.  
  3825.       
  3826.  
  3827.       
  3828.  
  3829.       
  3830.  
  3831.       
  3832.  
  3833.       
  3834.  
  3835.       
  3836.  
  3837.       
  3838.  
  3839.       
  3840.  
  3841.  
  3842.  
  3843.       TASM - Table Driven Assembler                                Page 33  
  3844.  
  3845.       
  3846.  
  3847.       
  3848.  
  3849.       8051 INSTRUCTIONS AND ADDRESSING MODES
  3850.  
  3851.       
  3852.  
  3853.       The following list shows the acceptable opcode mnemonics  and  their
  3854.  
  3855.       corresponding  operand  formats for the 8051 version of TASM.  Where
  3856.  
  3857.       'Rn' is seen,  R0 through R7  may  be  substituted.  Other  symbolic
  3858.  
  3859.       fields are as follows:
  3860.  
  3861.       
  3862.  
  3863.               SYMBOLIC            DESCRIPTION
  3864.  
  3865.               -----------------------------------------------
  3866.  
  3867.               <addr11>            Absolute address (11 bits)
  3868.  
  3869.               <addr16>            Absolute address (16 bits)
  3870.  
  3871.               <bit>               Bit address
  3872.  
  3873.               <immed>             Immediate data
  3874.  
  3875.               <direct>            Direct RAM address
  3876.  
  3877.               <rel>               Relative address
  3878.  
  3879.       
  3880.  
  3881.       Any valid TASM expression can appear in the  place  of  any  of  the
  3882.  
  3883.       above symbolics.
  3884.  
  3885.       
  3886.  
  3887.       OPCODE  OPERAND             DESCRIPTION
  3888.  
  3889.       --------------------------------------------------------------------
  3890.  
  3891.       ACALL   <addr11>            Absolute Call
  3892.  
  3893.       
  3894.  
  3895.       ADD     A,Rn                Add Register to Acc
  3896.  
  3897.       ADD     A,@R0               Add Indirect RAM to Acc
  3898.  
  3899.       ADD     A,@R1               Add Indirect RAM to Acc
  3900.  
  3901.       ADD     A,#<immed>          Add Immediate data to Acc
  3902.  
  3903.       ADD     A,<direct>          Add Direct RAM to Acc
  3904.  
  3905.       
  3906.  
  3907.       ADDC    A,Rn                Add Register to Acc with carry
  3908.  
  3909.       ADDC    A,@R0               Add Indirect RAM to Acc with carry
  3910.  
  3911.       ADDC    A,@R1               Add Indirect RAM to Acc with carry
  3912.  
  3913.       ADDC    A,#<immed>          Add Immediate data to Acc with carry
  3914.  
  3915.       ADDC    A,<direct>          Add Direct RAM to Acc with carry
  3916.  
  3917.       
  3918.  
  3919.       AJMP    <addr11>            Absolute Jump
  3920.  
  3921.       
  3922.  
  3923.       ANL     A,Rn                AND Register and Acc
  3924.  
  3925.       ANL     A,@R0               AND Indirect RAM and Acc
  3926.  
  3927.       ANL     A,@R1               AND Indirect RAM and Acc
  3928.  
  3929.       ANL     A,#<immed>          AND Immediate data and Acc
  3930.  
  3931.       ANL     A,<direct>          AND Direct RAM and Acc
  3932.  
  3933.       ANL     C,/<direct>         AND Complement of direct bit to Carry
  3934.  
  3935.       ANL     C,<direct>          AND direct bit to Carry
  3936.  
  3937.       ANL     <direct>,A          AND Acc to direct RAM
  3938.  
  3939.       ANL     <direct>,#<immed>   AND Immediate data and direct RAM
  3940.  
  3941.       
  3942.  
  3943.       CJNE    A,#<immed>,<rel>    Compare Immediate to Acc   and JNE
  3944.  
  3945.       CJNE    A,<direct>,<rel>    Compare direct RAM to Acc and JNE
  3946.  
  3947.       CJNE    Rn,#<immed>,<rel>   Compare Immediate to Register and JNE
  3948.  
  3949.       CJNE    @R0,#<immed>,<rel>  Compare Immediate to Indirect RAM and JNE
  3950.  
  3951.       CJNE    @R1,#<immed>,<rel>  Compare Immediate to Indirect RAM and JNE
  3952.  
  3953.       
  3954.  
  3955.       CLR     A                   Clear Accumulator
  3956.  
  3957.       CLR     C                   Clear Carry
  3958.  
  3959.       CLR     <direct>            Clear Direct RAM
  3960.  
  3961.  
  3962.  
  3963.       TASM - Table Driven Assembler                                Page 34  
  3964.  
  3965.       
  3966.  
  3967.       
  3968.  
  3969.       CPL     A                   Complement Accumulator
  3970.  
  3971.       CPL     C                   Complement Carry
  3972.  
  3973.       CPL     <direct>            Complement Direct RAM
  3974.  
  3975.       
  3976.  
  3977.       DA      A                   Decimal Adjust Accumulator
  3978.  
  3979.       
  3980.  
  3981.       DEC     A                   Decrement Acc
  3982.  
  3983.       DEC     Rn                  Decrement Register
  3984.  
  3985.       DEC     @R0                 Decrement Indirect RAM
  3986.  
  3987.       DEC     @R1                 Decrement Indirect RAM
  3988.  
  3989.       DEC     <direct>            Decrement Direct RAM
  3990.  
  3991.       
  3992.  
  3993.       DIV     AB                  Divide Acc by B
  3994.  
  3995.       
  3996.  
  3997.       DJNZ    Rn,<rel>            Decrement Register and JNZ
  3998.  
  3999.       DJNZ    <direct>,<rel>      Decrement Direct RAM and JNZ
  4000.  
  4001.       
  4002.  
  4003.       INC     A                   Increment Acc
  4004.  
  4005.       INC     Rn                  Increment Register
  4006.  
  4007.       INC     @R0                 Increment Indirect RAM
  4008.  
  4009.       INC     @R1                 Increment Indirect RAM
  4010.  
  4011.       INC     DPTR                Increment Data Pointer
  4012.  
  4013.       INC     <direct>            Increment Direct RAM
  4014.  
  4015.       
  4016.  
  4017.       JB      <bit>,<rel>         Jump if Bit is set
  4018.  
  4019.       JBC     <bit>,<rel>         Jump if Bit is set & clear Bit
  4020.  
  4021.       JC      <rel>               Jump if Carry is set
  4022.  
  4023.       JMP     @A+DPTR             Jump indirect relative to Data Pointer
  4024.  
  4025.       JNB     <bit>,<rel>         Jump if Bit is clear
  4026.  
  4027.       JNC     <rel>               Jump if Carry is clear
  4028.  
  4029.       JNZ     <rel>               Jump if Acc is not zero
  4030.  
  4031.       JZ      <rel>               Jump if Acc is zero
  4032.  
  4033.       
  4034.  
  4035.       LCALL   <addr16>            Long Subroutine Call
  4036.  
  4037.       LJMP    <addr16>            Long Jump
  4038.  
  4039.       
  4040.  
  4041.       MOV     A,Rn                Move Register to Acc
  4042.  
  4043.       MOV     A,@R0               Move Indirect RAM to Acc
  4044.  
  4045.       MOV     A,@R1               Move Indirect RAM to Acc
  4046.  
  4047.       MOV     A,#<immed>          Move Immediate data to Acc
  4048.  
  4049.       MOV     A,<direct>          Move direct RAM to Acc
  4050.  
  4051.       MOV     C,<bit>             Move bit to Acc
  4052.  
  4053.       MOV     DPTR,#<immed>       Move immediate data to Data Pointer
  4054.  
  4055.       MOV     Rn,A                Move Acc to Register
  4056.  
  4057.       MOV     Rn,#<immed>         Move Immediate data to Register
  4058.  
  4059.       MOV     Rn,<direct>         Move Direct RAM to Register
  4060.  
  4061.       MOV     @R0,A               Move Acc to Indirect RAM
  4062.  
  4063.       MOV     @R1,A               Move Acc to Indirect RAM
  4064.  
  4065.       MOV     @R0,#<immed>        Move Immediate data to Indirect RAM
  4066.  
  4067.       MOV     @R1,#<immed>        Move Immediate data to Indirect RAM
  4068.  
  4069.       MOV     @R0,<direct>        Move Direct RAM to Indirect RAM
  4070.  
  4071.       MOV     @R1,<direct>        Move Direct RAM to Indirect RAM
  4072.  
  4073.       MOV     <direct>,A          Move Acc to Direct RAM
  4074.  
  4075.       MOV     <bit>,C             Move Carry to Bit
  4076.  
  4077.       MOV     <direct>,Rn         Move Register to Direct RAM
  4078.  
  4079.       MOV     <direct>,@R0        Move Indirect RAM to Direct RAM
  4080.  
  4081.  
  4082.  
  4083.       TASM - Table Driven Assembler                                Page 35  
  4084.  
  4085.       
  4086.  
  4087.       MOV     <direct>,@R1        Move Indirect RAM to Direct RAM
  4088.  
  4089.       MOV     <direct>,#<immed>   Move Immediate data to Direct RAM
  4090.  
  4091.       MOV     <direct>,<direct>   Move Direct RAM to Direct RAM
  4092.  
  4093.       MOVC    A,@A+DPTR           Move code byte relative to DPTR to Acc
  4094.  
  4095.       MOVC    A,@A+PC             Move code byte relative to PC to Acc
  4096.  
  4097.       
  4098.  
  4099.       MOVX    A,@R0               Move external RAM to Acc
  4100.  
  4101.       MOVX    A,@R1               Move external RAM to Acc
  4102.  
  4103.       MOVX    A,@DPTR             Move external RAM to Acc (16 bit addr)
  4104.  
  4105.       MOVX    @R0,A               Move Acc to external RAM
  4106.  
  4107.       MOVX    @R1,A               Move Acc to external RAM
  4108.  
  4109.       MOVX    @DPTR,A             Move Acc to external RAM (16 bit addr)
  4110.  
  4111.       
  4112.  
  4113.       MUL     AB                  Multiply Acc by B
  4114.  
  4115.       
  4116.  
  4117.       NOP                         No operation
  4118.  
  4119.       
  4120.  
  4121.       ORL     A,Rn                OR Register and Acc
  4122.  
  4123.       ORL     A,@R0               OR Indirect RAM and Acc
  4124.  
  4125.       ORL     A,@R1               OR Indirect RAM and Acc
  4126.  
  4127.       ORL     A,#<immed>          OR Immediate data and Acc
  4128.  
  4129.       ORL     A,<direct>          OR Direct RAM and Acc
  4130.  
  4131.       ORL     C,/<direct>         OR Complement of direct bit to Carry
  4132.  
  4133.       ORL     C,<direct>          OR direct bit to Carry
  4134.  
  4135.       ORL     <direct>,A          OR Acc to direct RAM
  4136.  
  4137.       ORL     <direct>,#<immed>   OR Immediate data and direct RAM
  4138.  
  4139.       
  4140.  
  4141.       POP     <direct>            Pop  from Stack and put in Direct RAM
  4142.  
  4143.       PUSH    <direct>            Push from Direct RAM to Stack
  4144.  
  4145.       
  4146.  
  4147.       RET                         Return from subroutine
  4148.  
  4149.       RETI                        Return from Interrupt
  4150.  
  4151.       
  4152.  
  4153.       RL      A                   Rotate Acc left
  4154.  
  4155.       RLC     A                   Rotate Acc left through Carry
  4156.  
  4157.       RR      A                   Rotate Acc right
  4158.  
  4159.       RRC     A                   Rotate Acc right through Carry
  4160.  
  4161.       
  4162.  
  4163.       SETB    C                   Set the Carry Bit
  4164.  
  4165.       SETB    <bit>               Set Direct Bit
  4166.  
  4167.       
  4168.  
  4169.       SJMP    <rel>               Short jump
  4170.  
  4171.       
  4172.  
  4173.       SUBB    A,Rn                Subtract Register from Acc with Borrow
  4174.  
  4175.       SUBB    A,@R0               Subtract Indirect RAM from Acc w/ Borrow
  4176.  
  4177.       SUBB    A,@R1               Subtract Indirect RAM from Acc w/ Borrow
  4178.  
  4179.       SUBB    A,#<immed>          Subtract Immediate data from Acc w/ Borrow
  4180.  
  4181.       SUBB    A,<direct>          Subtract Direct RAM from Acc w/ Borrow
  4182.  
  4183.       
  4184.  
  4185.       SWAP    A                   Swap nibbles of Acc
  4186.  
  4187.       
  4188.  
  4189.       XCH     A,Rn                Exchange Acc with Register
  4190.  
  4191.       XCH     A,@R0               Exchange Acc with Indirect RAM
  4192.  
  4193.       XCH     A,@R1               Exchange Acc with Indirect RAM
  4194.  
  4195.       XCH     A,<direct>          Exchange Acc with Direct RAM
  4196.  
  4197.       
  4198.  
  4199.       XCHD    A,@R0               Exchange Digit in Acc with Indirect RAM
  4200.  
  4201.  
  4202.  
  4203.       TASM - Table Driven Assembler                                Page 36  
  4204.  
  4205.       
  4206.  
  4207.       XCHD    A,@R1               Exchange Digit in Acc with Indirect RAM
  4208.  
  4209.       
  4210.  
  4211.       XRL     A,Rn                Exclusive OR Register and Acc
  4212.  
  4213.       XRL     A,@R0               Exclusive OR Indirect RAM and Acc
  4214.  
  4215.       XRL     A,@R1               Exclusive OR Indirect RAM and Acc
  4216.  
  4217.       XRL     A,#<immed>          Exclusive OR Immediate data and Acc
  4218.  
  4219.       XRL     A,<direct>          Exclusive OR Direct RAM and Acc
  4220.  
  4221.       XRL     <direct>,A          Exclusive OR Acc to direct RAM
  4222.  
  4223.       XRL     <direct>,#<immed>   Exclusive OR Immediate data and direct RAM
  4224.  
  4225.       
  4226.  
  4227.       Note  that  the above tables do not automatically define the various
  4228.  
  4229.       mnemonics that may be  used  for  addressing  the  special  function
  4230.  
  4231.       registers  of  the  8051.  The  user  may  wish  to set up a file of
  4232.  
  4233.       equates (EQU's) that can be included in the  source  file  for  this
  4234.  
  4235.       purpose.  The following illustrates some of the appropriate equates:
  4236.  
  4237.       
  4238.  
  4239.       P0      .equ    080H    ;Port 0
  4240.  
  4241.       SP      .equ    081H    ;Stack pointer
  4242.  
  4243.       DPL     .equ    082H
  4244.  
  4245.       DPH     .equ    083H
  4246.  
  4247.       PCON    .equ    087H
  4248.  
  4249.       TCON    .equ    088H
  4250.  
  4251.       TMOD    .equ    089H
  4252.  
  4253.       TL0     .equ    08AH
  4254.  
  4255.       TL1     .equ    08BH
  4256.  
  4257.       TH0     .equ    08CH
  4258.  
  4259.       TH1     .equ    08DH
  4260.  
  4261.       P1      .equ    090H    ;Port 1
  4262.  
  4263.       SCON    .equ    098H
  4264.  
  4265.       SBUF    .equ    099H
  4266.  
  4267.       P2      .equ    0A0H    ;Port 2
  4268.  
  4269.       IEC     .equ    0A8H
  4270.  
  4271.       P3      .equ    0B0H    ;Port 3
  4272.  
  4273.       IPC     .equ    0B8H
  4274.  
  4275.       PSW     .equ    0D0H
  4276.  
  4277.       ACC     .equ    0E0H    ;Accumulator
  4278.  
  4279.       B       .equ    0F0H    ;Secondary Accumulator
  4280.  
  4281.       ;Now some bit addresses
  4282.  
  4283.       P0.0    .equ    080H    ;Port 0 bit 0
  4284.  
  4285.       P0.1    .equ    081H    ;Port 0 bit 1
  4286.  
  4287.       P0.2    .equ    082H    ;Port 0 bit 2
  4288.  
  4289.       P0.3    .equ    083H    ;Port 0 bit 3
  4290.  
  4291.       P0.4    .equ    080H    ;Port 0 bit 4
  4292.  
  4293.       P0.5    .equ    081H    ;Port 0 bit 5
  4294.  
  4295.       P0.6    .equ    082H    ;Port 0 bit 6
  4296.  
  4297.       P0.7    .equ    083H    ;Port 0 bit 7
  4298.  
  4299.       ACC.0   .equ    0E0H    ;Acc bit 0
  4300.  
  4301.       ACC.1   .equ    0E1H    ;Acc bit 1
  4302.  
  4303.       ACC.2   .equ    0E2H    ;Acc bit 2
  4304.  
  4305.       ACC.3   .equ    0E3H    ;Acc bit 3
  4306.  
  4307.       ACC.4   .equ    0E4H    ;Acc bit 4
  4308.  
  4309.       ACC.5   .equ    0E5H    ;Acc bit 5
  4310.  
  4311.       ACC.6   .equ    0E6H    ;Acc bit 6
  4312.  
  4313.       Acc.7   .equ    0E7H    ;Acc bit 7
  4314.  
  4315.       
  4316.  
  4317.       See the manufacturer's data sheets for more information.
  4318.  
  4319.       
  4320.  
  4321.  
  4322.  
  4323.       TASM - Table Driven Assembler                                Page 37  
  4324.  
  4325.       
  4326.  
  4327.       
  4328.  
  4329.       TASM DISTRIBUTION FILES
  4330.  
  4331.       
  4332.  
  4333.       TASM  is  distributed  in  two  different  packages  - an executable
  4334.  
  4335.       package and a source package.  The files  associated  with  each  of
  4336.  
  4337.       these are described below:
  4338.  
  4339.       
  4340.  
  4341.               EXECUTABLE PACKAGE
  4342.  
  4343.               ------------------------------------------------------------
  4344.  
  4345.               1.  TASM.EXE          - TASM Assembler, executable
  4346.  
  4347.               2.  TASM48.TAB        - 8048 Instruction definition table
  4348.  
  4349.               3.  TASM51.TAB        - 8051 Instruction definition table
  4350.  
  4351.               4.  TASM65.TAB        - 6502 Instruction definition table
  4352.  
  4353.               5.  TASM.DOC          - TASM Documentation
  4354.  
  4355.               6.  README            - Brief Explanation of Disk contents
  4356.  
  4357.       
  4358.  
  4359.               SOURCE PACKAGE
  4360.  
  4361.               ------------------------------------------------------------
  4362.  
  4363.               1.  TASM.EXE          - TASM Assembler, executable
  4364.  
  4365.               2.  TASM48.TAB        - 8048 Instruction definition table
  4366.  
  4367.               3.  TASM51.TAB        - 8051 Instruction definition table
  4368.  
  4369.               4.  TASM65.TAB        - 6502 Instruction definition table
  4370.  
  4371.               5.  TASM.DOC          - TASM Documentation
  4372.  
  4373.               6.  README            - Brief Explanation of Disk contents
  4374.  
  4375.       
  4376.  
  4377.               7.  TASM.C            - TASM mainline source code
  4378.  
  4379.               8.  STRLIB.C          - String library
  4380.  
  4381.               9.  IOLIB.C           - I/O Library
  4382.  
  4383.               10. MACRO.C           - Assembler directive support library
  4384.  
  4385.               11. CMAIN.C           - Command line parser
  4386.  
  4387.               12. CT.ASM            - MSDOS/C Interface module (startup)
  4388.  
  4389.               13. FUNC.ASM          - Assembly language functions
  4390.  
  4391.               14. UBYTE.H           - Header file defining unsigned types
  4392.  
  4393.               15. TASM.H            - Header file defining TASM constants
  4394.  
  4395.               16. TASMBLD.BAT       - Batch file to build TASM.EXE
  4396.  
  4397.       
  4398.  
  4399.       The  'C'  modules  can  be compiled with the Microsoft 'C' compiler,
  4400.  
  4401.       version 2.03  using  the  small  memory  model.  It  should  not  be
  4402.  
  4403.       difficult to use other 'C' compilers, however, because no library is
  4404.  
  4405.       needed and typical portability problems have been avoided.
  4406.  
  4407.       
  4408.  
  4409.       The  assembler  files  can  be  assembled  using the Microsoft Macro
  4410.  
  4411.       Assembler (MASM) or  equivalent.  The  standard  link  utility  that
  4412.  
  4413.       comes  with  MSDOS (Microsoft LINK) can be used to perform the link.
  4414.  
  4415.       The TASMBLD.BAT file demonstrates  steps  necessary  for  compiling,
  4416.  
  4417.       assembling and linking.
  4418.  
  4419.       
  4420.  
  4421.       
  4422.  
  4423.       
  4424.  
  4425.       
  4426.  
  4427.       
  4428.  
  4429.       
  4430.  
  4431.       
  4432.  
  4433.       
  4434.  
  4435.       
  4436.  
  4437.       
  4438.  
  4439.       
  4440.  
  4441.  
  4442.  
  4443.       TASM - Table Driven Assembler                                Page 38  
  4444.  
  4445.       
  4446.  
  4447.       
  4448.  
  4449.       PORTING TASM TO OTHER ENVIRONMENTS
  4450.  
  4451.       
  4452.  
  4453.       TASM source code is fairly portable.  We,  however, have only tested
  4454.  
  4455.       it in two environments,  Berkeley UNIX (BSD 4.2) and MSDOS 2.1 (UNIX
  4456.  
  4457.       is  a  trademark  of  AT&T,  MSDOS  is  a  trademark  of Microsoft).
  4458.  
  4459.       Portability is enhanced by:
  4460.  
  4461.       
  4462.  
  4463.               1.  All identifiers are unique to 6 characters.
  4464.  
  4465.               2.  No floating point arithmetic.
  4466.  
  4467.               3.  No Long (32 bit) arithmetic.
  4468.  
  4469.               4.  No bit fields.
  4470.  
  4471.               5.  Self contained code (no library routines are necessary).
  4472.  
  4473.       
  4474.  
  4475.       
  4476.  
  4477.       It  should  be  noted that a number of the modules that are included
  4478.  
  4479.       with TASM are not  necessary  in  some  other  environments  because
  4480.  
  4481.       identical  facilities  are  part of the standard library.  TASM does
  4482.  
  4483.       not use any libraries from other vendors (including the Microsoft  C
  4484.  
  4485.       library  that comes with the compiler that was used to compile TASM)
  4486.  
  4487.       to ensure  no  copyrights  are  violated.  The  modules  that  would
  4488.  
  4489.       generally not be needed include:
  4490.  
  4491.       
  4492.  
  4493.               1.  iolib.c     This includes read(), write(), open(),
  4494.  
  4495.                                   close(), sprintf(), etc.
  4496.  
  4497.               2.  strlib.c    This includes strcpy(), strcmp(), isdigit(),
  4498.  
  4499.                                   isalnum(), etc.
  4500.  
  4501.               3.  cmain.c     Parses command line into argc, argv format.
  4502.  
  4503.               4.  ct.asm      Interface between MSDOS and Microsoft C.
  4504.  
  4505.               5.  func.asm    Peek and poke functions.
  4506.  
  4507.       
  4508.  
  4509.       
  4510.  
  4511.       For example, the following command can be used to make an executable
  4512.  
  4513.       version of TASM for the BSD 4.2 environment:
  4514.  
  4515.       
  4516.  
  4517.               %cc -DUNIX tasm.c macro.c  -o tasm
  4518.  
  4519.       
  4520.  
  4521.       The header files tasm.h and ubyte.h should also be available.
  4522.  
  4523.       
  4524.  
  4525.       Note  that the UNIX flag is being defined on the command line.  This
  4526.  
  4527.       causes the following things to happen:
  4528.  
  4529.       
  4530.  
  4531.               1.   Unsigned   word   and   byte   typedefs   are   defined
  4532.  
  4533.                       appropriately (Microsoft C 2.03  is  nonstandard  in
  4534.  
  4535.                       this respect).
  4536.  
  4537.       
  4538.  
  4539.               2.  Tasm.h includes sys/file.h instead of defining  its  own
  4540.  
  4541.                       file open constants.
  4542.  
  4543.       
  4544.  
  4545.               3.  TASM declares a 64 Kbyte array  in  which  to  hold  the
  4546.  
  4547.                       assembled   opcodes   and   data.   In   the   MSDOS
  4548.  
  4549.                       environment a 64 Kbyte segment is  used  immediately
  4550.  
  4551.                       following  the stack segment to hold the opcodes and
  4552.  
  4553.                       data.  This is done so a small  data  model  can  be
  4554.  
  4555.                       used  by  the compiler (since many compilers for the
  4556.  
  4557.                       MSDOS environment do not have  any  other  option  -
  4558.  
  4559.                       done  for  portability  to other MSDOS C compilers).
  4560.  
  4561.  
  4562.  
  4563.       TASM - Table Driven Assembler                                Page 39  
  4564.  
  4565.       
  4566.  
  4567.                       In the BSD UNIX environment,  64 Kbyte arrays are no
  4568.  
  4569.                       problem,  and  if you are porting the code to a like
  4570.  
  4571.                       environment (whether UNIX or not), the UNIX flag may
  4572.  
  4573.                       be  useful.   This  eliminates  calls   to   several
  4574.  
  4575.                       assembly   language  routines  defined  in  func.asm
  4576.  
  4577.                       (peekb, pokeb, and getsegs).  Also,  if you are only
  4578.  
  4579.                       interested  in  the 8048 version,  which really only
  4580.  
  4581.                       needs a  4  Kbyte  memory  space,  the  local  array
  4582.  
  4583.                       approach  would  suffice  and eliminate the need for
  4584.  
  4585.                       the assembly language calls.
  4586.  
  4587.       
  4588.  
  4589.       
  4590.  
  4591.       For information on building TASM in the MSDOS environment,  see  the
  4592.  
  4593.       TASMBLD.BAT file.
  4594.  
  4595.       
  4596.  
  4597.       
  4598.  
  4599.       
  4600.  
  4601.       
  4602.  
  4603.       
  4604.  
  4605.       
  4606.  
  4607.       
  4608.  
  4609.       
  4610.  
  4611.       
  4612.  
  4613.       
  4614.  
  4615.       
  4616.  
  4617.       
  4618.  
  4619.       
  4620.  
  4621.       
  4622.  
  4623.       
  4624.  
  4625.       
  4626.  
  4627.       
  4628.  
  4629.       
  4630.  
  4631.       
  4632.  
  4633.       
  4634.  
  4635.       
  4636.  
  4637.       
  4638.  
  4639.       
  4640.  
  4641.       
  4642.  
  4643.       
  4644.  
  4645.       
  4646.  
  4647.       
  4648.  
  4649.       
  4650.  
  4651.       
  4652.  
  4653.       
  4654.  
  4655.       
  4656.  
  4657.       
  4658.  
  4659.       
  4660.  
  4661.       
  4662.  
  4663.       
  4664.  
  4665.       
  4666.  
  4667.       
  4668.  
  4669.       
  4670.  
  4671.       
  4672.  
  4673.       
  4674.  
  4675.       
  4676.  
  4677.       
  4678.  
  4679.       
  4680.  
  4681.  
  4682.  
  4683.       TASM - Table Driven Assembler                                Page 40  
  4684.  
  4685.       
  4686.  
  4687.       
  4688.  
  4689.       TASM INSTRUCTION SET TABLE DEFINITION
  4690.  
  4691.       
  4692.  
  4693.       The tables that control TASM's interpretation of the source file are
  4694.  
  4695.       read from a file at run time.  The table file name is determined  by
  4696.  
  4697.       taking  the  numeric option field specified on the TASM command line
  4698.  
  4699.       and appending it to the string "TASM", then a  ".TAB"  extension  is
  4700.  
  4701.       added.  Thus, if the following command line is entered:
  4702.  
  4703.       
  4704.  
  4705.               tasm -51  test.asm
  4706.  
  4707.       
  4708.  
  4709.       then TASM would read the table file named "TASM51.TAB".
  4710.  
  4711.       
  4712.  
  4713.       
  4714.  
  4715.       
  4716.  
  4717.       The following rules apply to the structure of the table file:
  4718.  
  4719.       
  4720.  
  4721.               1.  The  first  line  of  the  file  should contain a string
  4722.  
  4723.                       surrounded by double quotes that should identify the
  4724.  
  4725.                       version of the assembler  table.  This  string  will
  4726.  
  4727.                       appear at the top of each page in the list file.  It
  4728.  
  4729.                       should be limited to 24 characters.
  4730.  
  4731.       
  4732.  
  4733.               2.  Any  line  whose  first  character  is not alphabetic is
  4734.  
  4735.                       considered to be a comment and is discarded.
  4736.  
  4737.       
  4738.  
  4739.               3.  Any  line  that has an alphabetic character as the first
  4740.  
  4741.                       character is assumed to be an instruction definition
  4742.  
  4743.                       record  and  is  parsed  to   build   the   internal
  4744.  
  4745.                       representation  of the instruction set tables.   Six
  4746.  
  4747.                       fields (separated by white space) are  expected,  as
  4748.  
  4749.                       follows:
  4750.  
  4751.       
  4752.  
  4753.                       Field Name      Description
  4754.  
  4755.                       --------------------------------------------
  4756.  
  4757.                       INSTRUCTION     Instruction Mnemonic
  4758.  
  4759.                       ARGS            Argument definition
  4760.  
  4761.                       OPCODE          Opcode value
  4762.  
  4763.                       NBYTES          Number of bytes
  4764.  
  4765.                       MODOP           Modifier operation
  4766.  
  4767.                       CLASS           Instruction class
  4768.  
  4769.       
  4770.  
  4771.       
  4772.  
  4773.                       INSTRUCTION.  The  INSTRUCTION  field should contain
  4774.  
  4775.                       the string to be  used  as  the  mnemonic  for  this
  4776.  
  4777.                       instruction.  Upper case letters should be used (the
  4778.  
  4779.                       source statements are converted to upper case before
  4780.  
  4781.                       comparison).
  4782.  
  4783.       
  4784.  
  4785.       
  4786.  
  4787.                       ARGS.   The  ARGS  field  should  contain  a  string 
  4788.  
  4789.                       describing  the  format  of  the operand field.  All 
  4790.  
  4791.                       characters are taken literally except the '*'  which 
  4792.  
  4793.                       denotes  the  presence  of  a valid TASM expression.  
  4794.  
  4795.                       Multiple '*'s can be used,  but all but the last one 
  4796.  
  4797.                       must  be  followed  by  a  comma.  If  a  single '*' 
  4798.  
  4799.                       appears in the ARGS field,  then the default  action 
  4800.  
  4801.  
  4802.  
  4803.       TASM - Table Driven Assembler                                Page 41  
  4804.  
  4805.       
  4806.  
  4807.                       of  TASM  will  be  to  determine  the  value of the 
  4808.  
  4809.                       expression that matches the field and insert one  or 
  4810.  
  4811.                       two  bytes  of  it into the object file depending on 
  4812.  
  4813.                       the NBYTES field.  If multiple '*'s are  used,  then 
  4814.  
  4815.                       special  operators  (MODOP)  must  be  used  to take 
  4816.  
  4817.                       advantage of them (see the examples below).  An ARGS 
  4818.  
  4819.                       field of a pair  of  double  quotes  means  that  no 
  4820.  
  4821.                       arguments are expected.  
  4822.  
  4823.       
  4824.  
  4825.       
  4826.  
  4827.                       OPCODE.  The OPCODE field should contain the  opcode
  4828.  
  4829.                       value  (two  hex  digits)  for  this instruction and
  4830.  
  4831.                       address mode.
  4832.  
  4833.       
  4834.  
  4835.       
  4836.  
  4837.                       NBYTES.  The NBYTES field should specify the  number
  4838.  
  4839.                       of  bytes  this  instruction  is to occupy (a single
  4840.  
  4841.                       decimal digit).
  4842.  
  4843.       
  4844.  
  4845.       
  4846.  
  4847.                       MODOP.  The MODOP field determines  if  any  special
  4848.  
  4849.                       operations   need   to  be  performed  on  the  code
  4850.  
  4851.                       generated for this  instruction.  For  example,  the
  4852.  
  4853.                       zero-page  addressing  mode of the 6502 is a special
  4854.  
  4855.                       case of the absolute addressing mode, and is handled
  4856.  
  4857.                       by a special MODOP code (see appendix B).  The  list
  4858.  
  4859.                       of operators is as follows:
  4860.  
  4861.       
  4862.  
  4863.       
  4864.  
  4865.                       MODOP       DESCRIPTION
  4866.  
  4867.                       ---------------------------------------------------
  4868.  
  4869.                       NOTOUCH     Do nothing to instruction or args
  4870.  
  4871.                       JMPPAGE     Put bits 8-10 of first arg into
  4872.  
  4873.                                   bits 5-7 of opcode (8048 JMP)
  4874.  
  4875.                       ZPAGE       If arg < 256 then use zero-page (6502)
  4876.  
  4877.                       R1          Make arg relative to PC (single byte)
  4878.  
  4879.                       R2          Make arg relative to PC (two byte)
  4880.  
  4881.                       CREL        Combine LS bytes of first two args
  4882.  
  4883.                                   making the second one relative to PC
  4884.  
  4885.                       SWAP        Swap bytes of first arg
  4886.  
  4887.                       COMBINE     Combine LS bytes of first two args into
  4888.  
  4889.                                   first arg (arg1 -> LSB, arg2 ->MSB).
  4890.  
  4891.                       CSWAP       Combine LS bytes of first two args into
  4892.  
  4893.                                   first arg and swap.
  4894.  
  4895.       
  4896.  
  4897.                       Note  that the reason for the combining of arguments 
  4898.  
  4899.                       (COMBINE and CSWAP) is that TASM  assumes  that  all 
  4900.  
  4901.                       object  bytes  to be inserted in the object file are 
  4902.  
  4903.                       derived from a variable representing  the  value  of 
  4904.  
  4905.                       the  first  argument (argval).  If two arguments are 
  4906.  
  4907.                       in the  ARGS  field,  then  one  of  the  previously 
  4908.  
  4909.                       mentioned  MODOP`s  must  be  used.  They  have  the 
  4910.  
  4911.                       effect of combining the low bytes of the  first  two 
  4912.  
  4913.                       arguments  into the variable (argval) from which the 
  4914.  
  4915.                       object  code  will  be  generated.  TASM`s  argument 
  4916.  
  4917.                       parsing   routine  can  handle  a  large  number  of 
  4918.  
  4919.                       arguments,  but the code that generates  the  object 
  4920.  
  4921.  
  4922.  
  4923.       TASM - Table Driven Assembler                                Page 42  
  4924.  
  4925.       
  4926.  
  4927.                       code is less capable.  
  4928.  
  4929.       
  4930.  
  4931.                       CLASS.  The  CLASS  field is used to specify whether
  4932.  
  4933.                       this instruction is part of the standard instruction
  4934.  
  4935.                       set or a member of a set of  extended  instructions.
  4936.  
  4937.                       Bit 0 of this field should be set to denote a member
  4938.  
  4939.                       of  the standard instruction set.  Other bits can be
  4940.  
  4941.                       used as needed  to  establish  several  classes  (or
  4942.  
  4943.                       sets)   of  instructions  that  can  be  enabled  or
  4944.  
  4945.                       disabled via  the  '-x'  command  line  option  (see
  4946.  
  4947.                       section on 6502 INSTRUCTIONS AND ADDRESSING MODES).
  4948.  
  4949.       
  4950.  
  4951.       
  4952.  
  4953.       For  example  the  following  table   shows   possible   instruction
  4954.  
  4955.       definition  records,  followed  by  possible  source statements that
  4956.  
  4957.       would match it,  followed by the resulting object code that would be
  4958.  
  4959.       generated (in hex):
  4960.  
  4961.                                                       EXAMPLE
  4962.  
  4963.       INSTRUCTION DEFINITION                  SOURCE          OBJECT
  4964.  
  4965.       -------------------------------------------------------------------
  4966.  
  4967.       XYZ  *     FF  3  NOTOUCH 1             xyz 1234h       FF 34 12
  4968.  
  4969.       XYZ  *     FF  2  NOTOUCH 1             xyz 1234h       FF 34
  4970.  
  4971.       ZYX  *     FE  3  SWAP    1             zyx 1234h       FE 12 34
  4972.  
  4973.       ZYX  *     FE  3  R2      1             zyx $+4         FE 01 00
  4974.  
  4975.       ABC  *,*   FD  3  COMBINE 1             abc 45h,67h     FD 45 67
  4976.  
  4977.       ABC  *,*   FD  3  CSWAP   1             abc 45h,67h     FD 67 45
  4978.  
  4979.       ADD  A,#*  FC  2  NOTOUCH 1             add A,#'B'      FC 42
  4980.  
  4981.       RET  ""    FB  1  NOTOUCH 1             ret             FB
  4982.  
  4983.       
  4984.  
  4985.       See appendix B for more examples.
  4986.  
  4987.       
  4988.  
  4989.       The  order  of  the  entries for various addressing modes of a given 
  4990.  
  4991.       instruction is important.  Since the wild card matches anything,  it 
  4992.  
  4993.       is  important to specify the ARGS for the addressing modes that have 
  4994.  
  4995.       the  most  qualifying  characters  first.   For   example,   if   an 
  4996.  
  4997.       instruction  had  two  addressing  modes,   one  that  accepted  any 
  4998.  
  4999.       expression,  and another that required a pound sign in front  of  an 
  5000.  
  5001.       expression,  the  pound  sign  entry  should  go first otherwise all 
  5002.  
  5003.       occurrences of the instruction would match  the  more  general  ARGS 
  5004.  
  5005.       expression   that  it  encountered  first.   The  following  entries 
  5006.  
  5007.       illustrate the proper sequencing: 
  5008.  
  5009.       
  5010.  
  5011.               ADD #*  12 3 NOTOUCH 1
  5012.  
  5013.               ADD *   13 3 NOTOUCH 1
  5014.  
  5015.       
  5016.  
  5017.       
  5018.  
  5019.       
  5020.  
  5021.       
  5022.  
  5023.       
  5024.  
  5025.       
  5026.  
  5027.       
  5028.  
  5029.       
  5030.  
  5031.       
  5032.  
  5033.       
  5034.  
  5035.       
  5036.  
  5037.       
  5038.  
  5039.       
  5040.  
  5041.  
  5042.  
  5043.       TASM - Table Driven Assembler                                Page 43  
  5044.  
  5045.       
  5046.  
  5047.       
  5048.  
  5049.       SUMMARY
  5050.  
  5051.       --------------------------------------------------------------------------------------------------------------------------
  5052.  
  5053.       COMMAND LINE:                                               | DIRECTIVES:
  5054.  
  5055.         tasm -vv [-bcfhlmpxdo] source_file [obj_file [list_file]] |   #INCLUDE <filename> Read <filename> as source
  5056.  
  5057.                                                                   |   #DEFINE  <label> [<macro_def>] Define a macro
  5058.  
  5059.         -<vv>   Select version (-48, -51, or -65)                 |   #IFDEF   <label>    Assemble following if <label> DEFINEd
  5060.  
  5061.         -o<nn>  Specify number of obj bytes per record (hex)      |   #IFNDEF  <label>    Assemble following if <label> not DEFd
  5062.  
  5063.         -c      object file written as a contiguous block         |   #IF      <expr>     Assemble following if <expr> nonzero
  5064.  
  5065.         -d<mac> define a macro                                    |   #ELSE               Alternate block to assemble
  5066.  
  5067.         -f<xx>  Fill entire memory space with <xx> (hex)          |   #ENDIF              End of conditional block
  5068.  
  5069.         -h      Produce hex table of the assembled code           |   .ORG     <expr>     Set Instruction Pointer
  5070.  
  5071.         -l      Produce a label table in the listing              |   .BYTE    <expr>     Define a byte
  5072.  
  5073.         -m      Produce object in MOS Technology format           |   .WORD    <expr>     Define a word (lsb, msb)
  5074.  
  5075.         -b      Produce object in binary (.COM) format            |   .EQU     <expr>     Assign a value to label
  5076.  
  5077.         -p      Page the listing file                             |   .TEXT    <string>   Define bytes as ASCII characters
  5078.  
  5079.         -x<m>   Enable extended instruction set (m = class mask)  |   .BLOCK   <expr>     Block space reserve
  5080.  
  5081.         -q      Quite, disable listing file                       |   .TITLE   <string>   Set a title to appear on listing
  5082.  
  5083.       ------------------------------------------------------------|   .EJECT              Do Top of Form on listing
  5084.  
  5085.       OPERATORS:                                                  |   .LIST               Turn listing on
  5086.  
  5087.         Operator  Type          Description                       |   .NOLIST             Turn listing off
  5088.  
  5089.         __________________________________________                |   .PAGE               Turn paging on
  5090.  
  5091.         +        Additive       addition                          |   .NOPAGE             Turn paging off
  5092.  
  5093.         -                       subtraction                       |   .ADDINSTR <instdef> Add instruction
  5094.  
  5095.         *        Multiplicative multiplication                    |   .END                End of source code
  5096.  
  5097.         /                       division                          |   =        <expr>     Alternate form of EQU
  5098.  
  5099.         %                       modulo                            |   *=       <expr>     Alternate form of ORG
  5100.  
  5101.         <<                      logical shift left                |------------------------------------------------------
  5102.  
  5103.         >>                      logical shift right               | CONSTANTS:
  5104.  
  5105.         ~        Unary          bit inversion (one's complement)  |   Numeric constants: <digits><suffix>
  5106.  
  5107.         -                       unary negation                    |     <digits> = digit string taken from (0-9,a-f,A-F)
  5108.  
  5109.         =        Relational     equal                             |     <suffix> = radix indicator defined as follows:
  5110.  
  5111.         ==                      equal                             |
  5112.  
  5113.         !=                      not equal                         |     Suffix              Radix
  5114.  
  5115.         <                       less than                         |     ------------------------
  5116.  
  5117.         >                       greater than                      |     b or B               2   (or % prefix)
  5118.  
  5119.         <=                      less than or equal                |     o or O               8   (or @ prefix)
  5120.  
  5121.         >=                      greater than or equal             |     d or D (or nothing)  10
  5122.  
  5123.         &       Binary          binary 'and'                      |     h or H               16  (or $ prefix)
  5124.  
  5125.         |                       binary 'or'                       |
  5126.  
  5127.         ^                       binary 'exclusive or'             |   Character constants: '<char>' (printable ASCII
  5128.  
  5129.       Note: 16 bit values used.  Relational Ops yield 1 or 0.     |                         character surrounded by single
  5130.  
  5131.                                                                   |                         quotes, e.g. 'a'.
  5132.  
  5133.                                                                   |
  5134.  
  5135.       ------------------------------------------------------------|   String constants: "<characters>" (printable ASCII
  5136.  
  5137.       NOTES:                                                      |                      characters surrounded by double
  5138.  
  5139.        1. Statement format:<label> <operation> <operand> <comment>|                      quotes, e.g. "This is a string".
  5140.  
  5141.        2. The backslash can be used to separate multiple          |                      Used only for TEXT and TITLE.
  5142.  
  5143.               statements on a line (e.g. lda byte1 \ sta byte2).  |
  5144.  
  5145.        3. '$' or '*' represent the current Instruction Counter.   |
  5146.  
  5147.        4. Comments preceded by semicolon (';').                   |
  5148.  
  5149.        5. TASM is case insensitive for mnemonics, but not labels. |
  5150.  
  5151.        6. The default object file format is Intel Hex.            |
  5152.  
  5153.        7. For 6502 version -x3 option enables R65C02 instructions |
  5154.  
  5155.               and -x5 enables R65C00/21 instructions.             |
  5156.  
  5157.       --------------------------------------------------------------------------------------------------------------------------
  5158.  
  5159.       
  5160.  
  5161.  
  5162.  
  5163.       TASM - Table Driven Assembler                                Page 44  
  5164.  
  5165.       
  5166.  
  5167.       
  5168.  
  5169.       APPENDIX A - SAMPLE LISTING FILE
  5170.  
  5171.       
  5172.  
  5173.       The listing was generated by issuing the command:
  5174.  
  5175.               tasm -65 -p -l -h -f00 t.asm
  5176.  
  5177.       
  5178.  
  5179.       TASM 6502 Assembler.            t.asm                         page 1
  5180.  
  5181.       Speech Technology Incorporated.
  5182.  
  5183.       
  5184.  
  5185.       0001   0000             ;This is a simple example of an assembly
  5186.  
  5187.       0002   0000             ;include a file just for fun
  5188.  
  5189.       0003   0000             #include        "include.h"
  5190.  
  5191.       0001+  0000             ;this is just a simple include file
  5192.  
  5193.       0002+  0000             exit    .equ    7e00h
  5194.  
  5195.       0003+  0000             ;
  5196.  
  5197.       0004+  0000             ; That's all
  5198.  
  5199.       0004   0000             ;
  5200.  
  5201.       0005   0000             ; define two byte increment macro
  5202.  
  5203.       0006   0000             #define INCZ(p) ldx #p\ inc 0,x\ bne $+4\ inc 1,x
  5204.  
  5205.       0007   0000             ;
  5206.  
  5207.       0008   0000             start   .org    $0
  5208.  
  5209.       0009   0000             mask    .equ    $5678
  5210.  
  5211.       0010   0000
  5212.  
  5213.       0011   0000 0A          byte1   .byte   10
  5214.  
  5215.       0012   0001 D2 04       word1   .word   1234
  5216.  
  5217.       0013   0003 34 12       word2   .word   $1234
  5218.  
  5219.       0014   0005             ;skip past a few locations to start code
  5220.  
  5221.       0015   0020                     .org    $0020
  5222.  
  5223.       0016   0020             begin
  5224.  
  5225.       0017   0020             ;     let's just increment word1 the number
  5226.  
  5227.       0018   0020             ;     of times indicated by byte1 (use the
  5228.  
  5229.       0019   0020             ;     double byte increment macro INCZ).
  5230.  
  5231.       0020   0020             loop1
  5232.  
  5233.       0021   0020 A2 01               ldx #word1\ inc 0,x\ bne $+4\ inc 1,x
  5234.  
  5235.       0021   0022 F6 00
  5236.  
  5237.       0021   0024 D0 02
  5238.  
  5239.       0021   0026 F6 01
  5240.  
  5241.       0022   0028 C6 00               dec     byte1   ;decrement the count
  5242.  
  5243.       0023   002A D0 F4               bne     loop1   ;loop until zero
  5244.  
  5245.       0024   002C
  5246.  
  5247.       0025   002C             ; Now  let's just do some simple arithmetic
  5248.  
  5249.       0026   002C A5 56               lda     (mask >> 8)
  5250.  
  5251.       0027   002E AD 00 56            lda     (mask & 0ff00h)
  5252.  
  5253.       0028   0031 A5 57               lda     ((mask >> 8) & 0ffh) + word1
  5254.  
  5255.       0029   0033 4C 00 7E            jmp     exit
  5256.  
  5257.       0030   0036                     .end
  5258.  
  5259.       
  5260.  
  5261.       
  5262.  
  5263.       
  5264.  
  5265.       
  5266.  
  5267.       
  5268.  
  5269.       
  5270.  
  5271.       
  5272.  
  5273.       
  5274.  
  5275.       
  5276.  
  5277.       
  5278.  
  5279.       
  5280.  
  5281.  
  5282.  
  5283.       TASM - Table Driven Assembler                                Page 45  
  5284.  
  5285.       
  5286.  
  5287.       
  5288.  
  5289.       
  5290.  
  5291.       Label        Value      Label        Value      Label        Value
  5292.  
  5293.       ------------------      ------------------      ------------------
  5294.  
  5295.       exit          7E00      start         0000      mask          5678
  5296.  
  5297.       byte1         0000      word1         0001      word2         0003
  5298.  
  5299.       begin         0020      loop1         0020
  5300.  
  5301.       
  5302.  
  5303.       ADDR  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
  5304.  
  5305.       -----------------------------------------------------
  5306.  
  5307.       0000  0A D2 04 34 12 00 00 00 00 00 00 00 00 00 00 00
  5308.  
  5309.       0010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  5310.  
  5311.       0020  A2 01 F6 00 D0 02 F6 01 C6 00 D0 F4 A5 56 AD 00
  5312.  
  5313.       0030  56 A5 57 4C 00 7E 00 00 00 00 00 00 00 00 00 00
  5314.  
  5315.       
  5316.  
  5317.       tasm: Number of errors = 0
  5318.  
  5319.       
  5320.  
  5321.       
  5322.  
  5323.       
  5324.  
  5325.       
  5326.  
  5327.       
  5328.  
  5329.       
  5330.  
  5331.       
  5332.  
  5333.       
  5334.  
  5335.       
  5336.  
  5337.       
  5338.  
  5339.       
  5340.  
  5341.       
  5342.  
  5343.       
  5344.  
  5345.       
  5346.  
  5347.       
  5348.  
  5349.       
  5350.  
  5351.       
  5352.  
  5353.       
  5354.  
  5355.       
  5356.  
  5357.       
  5358.  
  5359.       
  5360.  
  5361.       
  5362.  
  5363.       
  5364.  
  5365.       
  5366.  
  5367.       
  5368.  
  5369.       
  5370.  
  5371.       
  5372.  
  5373.       
  5374.  
  5375.       
  5376.  
  5377.       
  5378.  
  5379.       
  5380.  
  5381.       
  5382.  
  5383.       
  5384.  
  5385.       
  5386.  
  5387.       
  5388.  
  5389.       
  5390.  
  5391.       
  5392.  
  5393.       
  5394.  
  5395.       
  5396.  
  5397.       
  5398.  
  5399.       
  5400.  
  5401.  
  5402.  
  5403.       TASM - Table Driven Assembler                                Page 46  
  5404.  
  5405.       
  5406.  
  5407.       
  5408.  
  5409.       APPENDIX B - SAMPLE INSTRUCTION DEFINITION TABLE (TASM65.TAB)
  5410.  
  5411.       
  5412.  
  5413.       "TASM 6502 Assembler.    "
  5414.  
  5415.       /* This is the instruction set definition table
  5416.  
  5417.       /*   for the 6502 version of TASM.
  5418.  
  5419.       /*      Thomas N. Anderson, Speech Technology Incorporated, Feb 1986.
  5420.  
  5421.       /*  First line of this file is a banner that will appear at the
  5422.  
  5423.       /*  top of each page of the TASM listing file (not the same as
  5424.  
  5425.       /*  the TITLE).  Should be limited to 24 characters.
  5426.  
  5427.       /*  Any other line that does not start with an upper case letter is
  5428.  
  5429.       /*  ignored.
  5430.  
  5431.       /*  See TASM manual for info on table structure.
  5432.  
  5433.       /*  Note that there are two classes of extended instructions beyond
  5434.  
  5435.       /*    the standard set.  The classes are assigned bits as follows:
  5436.  
  5437.       /*      bit 0 = standard set
  5438.  
  5439.       /*      bit 1 = extended instructions for R65C02
  5440.  
  5441.       /*      bit 2 = extended instructions for R65C00/21
  5442.  
  5443.       /*
  5444.  
  5445.       /*INSTR ARGS OPCODE BYTES MOD CLASS */
  5446.  
  5447.       /*----------------------------------*/
  5448.  
  5449.       ADC  #*     69    2  NOP 1
  5450.  
  5451.       ADC  (*,X)  61    2  NOP 1
  5452.  
  5453.       ADC  (*),Y  71    2  NOP 1
  5454.  
  5455.       ADC  (*)    72    2  NOP 2   /* R65C02 */
  5456.  
  5457.       ADC  *,X    7D    3  ZP  1
  5458.  
  5459.       ADC  *,Y    79    3  NOP 1
  5460.  
  5461.       ADC  *      6D    3  ZP  1
  5462.  
  5463.       
  5464.  
  5465.       AND  #*     29    2  NOP 1
  5466.  
  5467.       AND  (*,X)  21    2  NOP 1
  5468.  
  5469.       AND  (*),Y  31    2  NOP 1
  5470.  
  5471.       AND  (*)    32    2  NOP 2   /* R65C02 */
  5472.  
  5473.       AND  *,X    3D    3  ZP  1
  5474.  
  5475.       AND  *,Y    39    3  NOP 1
  5476.  
  5477.       AND  *      2D    3  ZP  1
  5478.  
  5479.       
  5480.  
  5481.       ASL  A      0A    1  NOP 1
  5482.  
  5483.       ASL  *,X    1E    3  ZP  1
  5484.  
  5485.       ASL  *      0E    3  ZP  1
  5486.  
  5487.       
  5488.  
  5489.       BCC  *      90    2  R1  1
  5490.  
  5491.       BCS  *      B0    2  R1  1
  5492.  
  5493.       BEQ  *      F0    2  R1  1
  5494.  
  5495.       BNE  *      D0    2  R1  1
  5496.  
  5497.       BMI  *      30    2  R1  1
  5498.  
  5499.       BPL  *      10    2  R1  1
  5500.  
  5501.       BVC  *      50    2  R1  1
  5502.  
  5503.       BVS  *      70    2  R1  1
  5504.  
  5505.       
  5506.  
  5507.       BIT  #*     89    2  NOP 2
  5508.  
  5509.       BIT  *,X    3C    3  ZP  2
  5510.  
  5511.       BIT  *      2C    3  ZP  1
  5512.  
  5513.       
  5514.  
  5515.       BRK  ""     00    1  NOP 1
  5516.  
  5517.       
  5518.  
  5519.       CLC  ""     18    1  NOP 1
  5520.  
  5521.  
  5522.  
  5523.       TASM - Table Driven Assembler                                Page 47  
  5524.  
  5525.       
  5526.  
  5527.       CLD  ""     D8    1  NOP 1
  5528.  
  5529.       CLI  ""     58    1  NOP 1
  5530.  
  5531.       CLV  ""     B8    1  NOP 1
  5532.  
  5533.       
  5534.  
  5535.       CMP  #*     C9    2  NOP 1
  5536.  
  5537.       CMP  (*,X)  C1    2  NOP 1
  5538.  
  5539.       CMP  (*),Y  D1    2  NOP 1
  5540.  
  5541.       CMP  (*)    D2    2  NOP 2
  5542.  
  5543.       CMP  *,X    DD    3  ZP  1
  5544.  
  5545.       CMP  *,Y    D9    3  NOP 1
  5546.  
  5547.       CMP  *      CD    3  ZP  1
  5548.  
  5549.       
  5550.  
  5551.       CPX  #*     E0    2  NOP 1
  5552.  
  5553.       CPX  *      EC    3  ZP  1
  5554.  
  5555.       
  5556.  
  5557.       CPY  #*     C0    2  NOP 1
  5558.  
  5559.       CPY  *      CC    3  ZP  1
  5560.  
  5561.       
  5562.  
  5563.       DEC  A      3A    3  NOP 2
  5564.  
  5565.       DEC  *,X    DE    3  ZP  1
  5566.  
  5567.       DEC  *      CE    3  ZP  1
  5568.  
  5569.       
  5570.  
  5571.       DEX  ""     CA    1  NOP 1
  5572.  
  5573.       DEY  ""     88    1  NOP 1
  5574.  
  5575.       
  5576.  
  5577.       EOR  #*     49    2  NOP 1
  5578.  
  5579.       EOR  (*,X)  41    2  NOP 1
  5580.  
  5581.       EOR  (*),Y  51    2  NOP 1
  5582.  
  5583.       EOR  (*)    52    2  NOP 2
  5584.  
  5585.       EOR  *,X    5D    3  ZP  1
  5586.  
  5587.       EOR  *,Y    59    3  NOP 1
  5588.  
  5589.       EOR  *      4D    3  ZP  1
  5590.  
  5591.       
  5592.  
  5593.       INC  A      1A    3  NOP 2
  5594.  
  5595.       INC  *,X    FE    3  ZP  1
  5596.  
  5597.       INC  *      EE    3  ZP  1
  5598.  
  5599.       
  5600.  
  5601.       INX  ""     E8    1  NOP 1
  5602.  
  5603.       INY  ""     C8    1  NOP 1
  5604.  
  5605.       
  5606.  
  5607.       JMP  (*,X)  7C    3  NOP 2
  5608.  
  5609.       JMP  (*)    6C    3  NOP 1
  5610.  
  5611.       JMP  *      4C    3  NOP 1
  5612.  
  5613.       
  5614.  
  5615.       JSR  *      20    3  NOP 1
  5616.  
  5617.       
  5618.  
  5619.       LDA  #*     A9    2  NOP 1
  5620.  
  5621.       LDA  (*,X)  A1    2  NOP 1
  5622.  
  5623.       LDA  (*),Y  B1    2  NOP 1
  5624.  
  5625.       LDA  (*)    B2    2  NOP 2
  5626.  
  5627.       LDA  *,X    BD    3  ZP  1
  5628.  
  5629.       LDA  *,Y    B9    3  NOP 1
  5630.  
  5631.       LDA  *      AD    3  ZP  1
  5632.  
  5633.       
  5634.  
  5635.       LDX  #*     A2    2  NOP 1
  5636.  
  5637.       LDX  *,Y    BE    3  ZP  1
  5638.  
  5639.       LDX  *      AE    3  ZP  1
  5640.  
  5641.  
  5642.  
  5643.       TASM - Table Driven Assembler                                Page 48  
  5644.  
  5645.       
  5646.  
  5647.       
  5648.  
  5649.       LDY  #*     A0    2  NOP 1
  5650.  
  5651.       LDY  *,X    BC    3  ZP  1
  5652.  
  5653.       LDY  *      AC    3  ZP  1
  5654.  
  5655.       
  5656.  
  5657.       LSR  A      4A    1  NOP 1
  5658.  
  5659.       LSR  *,X    5E    3  ZP  1
  5660.  
  5661.       LSR  *      4E    3  ZP  1
  5662.  
  5663.       
  5664.  
  5665.       NOP  ""     EA    1  NOP 1
  5666.  
  5667.       
  5668.  
  5669.       ORA  #*     09    2  NOP 1
  5670.  
  5671.       ORA  (*,X)  01    2  NOP 1
  5672.  
  5673.       ORA  (*),Y  11    2  NOP 1
  5674.  
  5675.       ORA  (*)    12    2  NOP 2
  5676.  
  5677.       ORA  *,X    1D    3  ZP  1
  5678.  
  5679.       ORA  *,Y    19    3  NOP 1
  5680.  
  5681.       ORA  *      0D    3  ZP  1
  5682.  
  5683.       
  5684.  
  5685.       PHA  ""     48    1  NOP 1
  5686.  
  5687.       PHP  ""     08    1  NOP 1
  5688.  
  5689.       PLA  ""     68    1  NOP 1
  5690.  
  5691.       PLP  ""     28    1  NOP 1
  5692.  
  5693.       
  5694.  
  5695.       ROL  A      2A    1  NOP 1
  5696.  
  5697.       ROL  *,X    3E    3  ZP  1
  5698.  
  5699.       ROL  *      2E    3  ZP  1
  5700.  
  5701.       
  5702.  
  5703.       ROR  A      6A    1  NOP 1
  5704.  
  5705.       ROR  *,X    7E    3  ZP  1
  5706.  
  5707.       ROR  *      6E    3  ZP  1
  5708.  
  5709.       
  5710.  
  5711.       RTI  ""     40    1  NOP 1
  5712.  
  5713.       RTS  ""     60    1  NOP 1
  5714.  
  5715.       
  5716.  
  5717.       SBC  #*     E9    2  NOP 1
  5718.  
  5719.       SBC  (*,X)  E1    2  NOP 1
  5720.  
  5721.       SBC  (*),Y  F1    2  NOP 1
  5722.  
  5723.       SBC  (*)    F2    2  NOP 2
  5724.  
  5725.       SBC  *,X    FD    3  ZP  1
  5726.  
  5727.       SBC  *,Y    F9    3  NOP 1
  5728.  
  5729.       SBC  *      ED    3  ZP  1
  5730.  
  5731.       
  5732.  
  5733.       SEC  ""     38    1  NOP 1
  5734.  
  5735.       SED  ""     F8    1  NOP 1
  5736.  
  5737.       SEI  ""     78    1  NOP 1
  5738.  
  5739.       
  5740.  
  5741.       STA  (*,X)  81    2  NOP 1
  5742.  
  5743.       STA  (*),Y  91    2  NOP 1
  5744.  
  5745.       STA  (*)    92    2  NOP 2
  5746.  
  5747.       STA  *,X    9D    3  ZP  1
  5748.  
  5749.       STA  *,Y    99    3  NOP 1
  5750.  
  5751.       STA  *      8D    3  ZP  1
  5752.  
  5753.       
  5754.  
  5755.       STX  *,Y    96    2  ZP  1
  5756.  
  5757.       STX  *      8E    3  ZP  1
  5758.  
  5759.       
  5760.  
  5761.  
  5762.  
  5763.       TASM - Table Driven Assembler                                Page 49  
  5764.  
  5765.       
  5766.  
  5767.       STY  *,X    94    2  NOP 1
  5768.  
  5769.       STY  *      8C    3  ZP  1
  5770.  
  5771.       
  5772.  
  5773.       TAX  ""     AA    1  NOP 1
  5774.  
  5775.       TAY  ""     A8    1  NOP 1
  5776.  
  5777.       TSX  ""     BA    1  NOP 1
  5778.  
  5779.       TXA  ""     8A    1  NOP 1
  5780.  
  5781.       TXS  ""     9A    1  NOP 1
  5782.  
  5783.       TYA  ""     98    1  NOP 1
  5784.  
  5785.       
  5786.  
  5787.       /* Here are the extended instructions that are totally new */
  5788.  
  5789.       
  5790.  
  5791.       BRA  *      80    2  R1  6
  5792.  
  5793.       
  5794.  
  5795.       BBR0 *,*    0f    3  CR  6
  5796.  
  5797.       BBR1 *,*    1f    3  CR  6
  5798.  
  5799.       BBR2 *,*    2f    3  CR  6
  5800.  
  5801.       BBR3 *,*    3f    3  CR  6
  5802.  
  5803.       BBR4 *,*    4f    3  CR  6
  5804.  
  5805.       BBR5 *,*    5f    3  CR  6
  5806.  
  5807.       BBR6 *,*    6f    3  CR  6
  5808.  
  5809.       BBR7 *,*    7f    3  CR  6
  5810.  
  5811.       
  5812.  
  5813.       BBS0 *,*    8f    3  CR  6
  5814.  
  5815.       BBS1 *,*    9f    3  CR  6
  5816.  
  5817.       BBS2 *,*    af    3  CR  6
  5818.  
  5819.       BBS3 *,*    bf    3  CR  6
  5820.  
  5821.       BBS4 *,*    cf    3  CR  6
  5822.  
  5823.       BBS5 *,*    df    3  CR  6
  5824.  
  5825.       BBS6 *,*    ef    3  CR  6
  5826.  
  5827.       BBS7 *,*    ff    3  CR  6
  5828.  
  5829.       
  5830.  
  5831.       MUL  ""     02    1  NOP 4  /* R65C00/21 only*/
  5832.  
  5833.       
  5834.  
  5835.       PHX  ""     da    1  NOP 6
  5836.  
  5837.       PHY  ""     5a    1  NOP 6
  5838.  
  5839.       PLX  ""     fa    1  NOP 6
  5840.  
  5841.       PLY  ""     7a    1  NOP 6
  5842.  
  5843.       
  5844.  
  5845.       RMB0 *      07    2  NOP 6
  5846.  
  5847.       RMB1 *      17    2  NOP 6
  5848.  
  5849.       RMB2 *      27    2  NOP 6
  5850.  
  5851.       RMB3 *      37    2  NOP 6
  5852.  
  5853.       RMB4 *      47    2  NOP 6
  5854.  
  5855.       RMB5 *      57    2  NOP 6
  5856.  
  5857.       RMB6 *      67    2  NOP 6
  5858.  
  5859.       RMB7 *      77    2  NOP 6
  5860.  
  5861.       
  5862.  
  5863.       SMB0 *      87    2  NOP 6
  5864.  
  5865.       SMB1 *      97    2  NOP 6
  5866.  
  5867.       SMB2 *      a7    2  NOP 6
  5868.  
  5869.       SMB3 *      b7    2  NOP 6
  5870.  
  5871.       SMB4 *      c7    2  NOP 6
  5872.  
  5873.       SMB5 *      d7    2  NOP 6
  5874.  
  5875.       SMB6 *      e7    2  NOP 6
  5876.  
  5877.       SMB7 *      f7    2  NOP 6
  5878.  
  5879.       
  5880.  
  5881.  
  5882.  
  5883.       TASM - Table Driven Assembler                                Page 50  
  5884.  
  5885.       
  5886.  
  5887.       /* The following extended instructions are available on the
  5888.  
  5889.               R65C02 but not the R65C00/21 */
  5890.  
  5891.       
  5892.  
  5893.       STZ  *,X    9e    3  ZP  2
  5894.  
  5895.       STZ  *      9c    3  ZP  2
  5896.  
  5897.       
  5898.  
  5899.       TRB  *      1c    3  ZP  2
  5900.  
  5901.       TSB  *      0c    3  ZP  2
  5902.  
  5903.       
  5904.  
  5905.       
  5906.  
  5907.       
  5908.  
  5909.       
  5910.  
  5911.       
  5912.  
  5913.       
  5914.  
  5915.       
  5916.  
  5917.       
  5918.  
  5919.       
  5920.  
  5921.       
  5922.  
  5923.       
  5924.  
  5925.       
  5926.  
  5927.       
  5928.  
  5929.       
  5930.  
  5931.       
  5932.  
  5933.       
  5934.  
  5935.       
  5936.  
  5937.       
  5938.  
  5939.       
  5940.  
  5941.       
  5942.  
  5943.       
  5944.  
  5945.       
  5946.  
  5947.       
  5948.  
  5949.       
  5950.  
  5951.       
  5952.  
  5953.       
  5954.  
  5955.       
  5956.  
  5957.       
  5958.  
  5959.       
  5960.  
  5961.       
  5962.  
  5963.       
  5964.  
  5965.       
  5966.  
  5967.       
  5968.  
  5969.       
  5970.  
  5971.       
  5972.  
  5973.       
  5974.  
  5975.       
  5976.  
  5977.       
  5978.  
  5979.       
  5980.  
  5981.       
  5982.  
  5983.       
  5984.  
  5985.       
  5986.  
  5987.       
  5988.  
  5989.       
  5990.  
  5991.       
  5992.  
  5993.       
  5994.  
  5995.       
  5996.  
  5997.       
  5998.  
  5999.       
  6000.  
  6001.  
  6002.  
  6003.       TASM - Table Driven Assembler                                Page 51  
  6004.  
  6005.       
  6006.  
  6007.       
  6008.  
  6009.       APPENDIX C - ORDERING INFORMATION
  6010.  
  6011.       
  6012.  
  6013.       TASM  is  distributed as shareware.  If you find it useful,  you are 
  6014.  
  6015.       encouraged to become a registered  user.  Registered  users  receive 
  6016.  
  6017.       the following benifits: 
  6018.  
  6019.                   
  6020.  
  6021.               1.  The recent version of TASM.
  6022.  
  6023.               2.  TASM source code (in C).
  6024.  
  6025.               3.  Bound TASM manual.
  6026.  
  6027.               4.  Knowledge that they are supporting  the  development  of 
  6028.  
  6029.                       useful but inexpensive software.  
  6030.  
  6031.       
  6032.  
  6033.       DESCRIPTION                     UNIT PRICE      QUANTITY      PRICE
  6034.  
  6035.       --------------------------------------------------------------------
  6036.  
  6037.       
  6038.  
  6039.       TASM Registration                    30.00      ________     _______
  6040.  
  6041.       
  6042.  
  6043.       TASM User's Manual (included above)  10.00      ________     _______
  6044.  
  6045.       
  6046.  
  6047.       
  6048.  
  6049.       Subtotal                                                     _______
  6050.  
  6051.       
  6052.  
  6053.       
  6054.  
  6055.       Tax (Washington state residents add 7.9%)                    _______
  6056.  
  6057.       
  6058.  
  6059.       
  6060.  
  6061.       TOTAL (post paid)                                            _______
  6062.  
  6063.       
  6064.  
  6065.       
  6066.  
  6067.       
  6068.  
  6069.       Shipping Address:
  6070.  
  6071.       
  6072.  
  6073.       ______________________________________________
  6074.  
  6075.       
  6076.  
  6077.       ______________________________________________
  6078.  
  6079.       
  6080.  
  6081.       ______________________________________________
  6082.  
  6083.       
  6084.  
  6085.       
  6086.  
  6087.       
  6088.  
  6089.       Send check or money order (no credit cards) to:
  6090.  
  6091.       
  6092.  
  6093.                       Speech Technology Incorporated
  6094.  
  6095.                       16321 176th Avenue NE
  6096.  
  6097.                       Woodinville, WA  98072
  6098.  
  6099.       
  6100.  
  6101.       
  6102.  
  6103.       
  6104.  
  6105.       
  6106.  
  6107.       
  6108.  
  6109.       
  6110.  
  6111.       
  6112.  
  6113.       
  6114.  
  6115.       
  6116.  
  6117.       
  6118.  
  6119.       
  6120.  
  6121.